Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The key part (for myself) of ForkMeOnTinder's comment was:

> Maybe I'm a beginner then. He lists a few cases where it's not worse than sticking to 8-bit bools, but no cases where it's actually an improvement. It still wastes memory sometimes

They key part of my response is sometimes "wasting memory" (to gain alignment) is a good thing.

If someone, a beginner, is concerned about percieved wasted memory then of course they will use "packed".

As for the guts of your comment, I agree with your sentiment but would exercise caution about expecting a compiler to do what you expect in practice - especially for cross architectural projects that are intended to be robust for a decade and more - code will be put through muliple compilers across multiple architectures and potentially many many flags will be appied that may conflict in unforseen ways with each other.

In general I supported the notion of sanity check routines that double check assumptions at runtime, if you want data aligned, require data to be big endian or small endian etc then have some runtime sanity checks that can verify this for specific executables on the target platform



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: