Login Register






Tutorial CYFA - Creating Your First Assembler - Getting Help filter_list
Author
Message
RE: CYFA - Creating Your First Assembler - Getting Help #6
(12-01-2017, 10:59 PM)Ender Wrote: "Relax, the code is correct. This actually comes down to why we did it this way. We're using a shared library to handle the conversion. This makes our code more platform independent. If we had used macros, then the code would only work for the exact system it was compiled on, but if we use a shared library, it will work on any system that has that library. This means that every system could have a different version of the library, and would always correlate to the endianness of the system it's being run on. We need to link that library. Go ahead and go to the build options and select as."

This is the most smooth, relaxing paragraph I have ever seen written about C code. I have no idea why it has that effect, it sends chills down my spine.

That was a lot of code, looking forward to the next part!

I had to write it like that because I was afraid of trolls running around telling me I could've just done
Code:
#if (!*(unsigned char *)&(uint16_t){1}) encode = htonl(encode); #endif
Which actually wouldn't work for our case. Using shared libraries defeats this issue, since the code is dependent on the host, not our program. The only thing worse than non-optimal code is trolls who think your code is non-optimal

[+] 1 user Likes phyrrus9's post
Reply





Messages In This Thread
RE: CYFA - Creating Your First Assembler - Getting Help - by phyrrus9 - 12-01-2017, 11:31 PM