3 ms·
Sooo adding a field to a struct is supposedly a non-code-breaking feature (yeah, right) but tweaking a constant isn't? This does not fit with my experience of
by torstenvl 8y ago
Sooo adding a field to a struct is supposedly a non-code-breaking feature (yeah, right) but tweaking a constant isn't?
This does not fit with my experience of the world.
- uryga 8y agoCould you describe some situations where adding a field broke stuff? I can only imagine that happening if your code cares about the exact binary representation/layout of a struct - so serialization, FFI or just bit-twiddling.
- torstenvl 8y agoSerialization is one, but anything involving casting from one struct to another (e.g., if the Berkeley sockets implementation changed the size of struct in_addr), anything requiring careful management of memory alignment (e.g., SSE), etc. could potentially be broken. Never mind the inevitable reckless coding practices that arise in the wild all the time (someone decides to #define a magic number for allocation purposes instead of using sizeof...). On the other hand, a large number of constants are supposed to be tweakable, to the extent that many are designed to be set at compile time. Anyway. OP article had good points overall, I'm just not sold on some of the specifics.