Skip to content

Comment on Understanding C by learning assemblyparent

Comments

Anything have to do with binary formats and I/O would qualify.

Let's say for example you're trying to load a binary file and the header format is like this:

16 bit magic number, 8 bit file size, 3 bit version, 5 bit header size

Now, are you confident enough in how structs are laid out in memory that you could use a bitfield to read these values in? Are you sure it would work on 32 bit, 64 bit, big and little endian machines? What is all that packed structure nonsense in GCC?

That's something that C abstracts away from you and can lead to errors.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.