Re:Elevate your C programming skills by exploring the SQLite...
by aleksei on Sunday July 09, 2017 @12:29PM
(#14730504)
i16 seems to be a typedef for short int, which may be actually be larger than 2 bytes depending on the compiler.
[ Parent
| on HN ]
Re:Elevate your C programming skills by exploring the SQLite...
by minipci1321 on Sunday July 09, 2017 @01:45PM
(#14730817)
Even more so:
-- the fact that the code didn't use the int16_t from stddef.h but rather defined their own, could hint in the sense that a signed-int-over-exactly-16-bits might be unavailable in the ABI. People defining their own exact-width integral types (instead of pulling in stddef.h), rarely think about how that makes the code harder to interpret for a reader.
Now, if the type i16 might indeed be wider than 16 bits, sizeof becomes perfectly justified but '16' is not.
Re:Elevate your C programming skills by exploring the SQLite...
by ivanbakel on Sunday July 09, 2017 @01:47PM
(#14730824)
If it's specified as i16, it would be exactly two bytes in all situations - there would be no logic in including a size parameter that didn't actually mean anything, and sized ints are specifically meant to be platform-independent.