3 ms·
1 + 3 + padding and 1 + 3 + 16 are repeated. I suspect the magic 16 is actually just the padding too.
by kzrdude 13y ago
1 + 3 + padding and 1 + 3 + 16 are repeated. I suspect the magic 16 is actually just the padding too.
- whadar 13y agoYeah, it just that you wanna make sure the padding variable is not being overridden by some malloc ;)
- nate_martin 13y agoI'm curious as to why they are not using constants or preprocessor macros for these values. It seems weird for it to be repeated in multiple places.
- wyager 13y agoProbably just to make it easier to understand what's going on. If they just had "20+..." it wouldn't give you any hints where the 20 came from.
- kzrdude 13y agoyou'd have a define with an understandable name instead of just the magic constant 20.
- mikeash 13y agoYou could even make a constant for 1, 3, and 16 separately, then still add them together in the code. It may seem excessive for such a small case, but in my experience it really helps readability to have kWhateverFieldSize instead of 1.