Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
No one knows the type of char+char (knatten.org)
1 point by betamark on Oct 10, 2019 | hide | past | favorite | 1 comment


I've been programming in C and C++ for a long time and so I got the answer to the quiz right. This kind of looseness in the language definition is why embedded programmers learn to stick to the fixed-size integer types, like uint8_t, int16_t, etc., defined in <stdint.h>

This doesn't fully solve the issues related to integer promotion, I think, but if you specify uint8_t, and there isn't an underlying type that exactly matches that size, the compiler should tell you, and you can re-think what you are doing (or, more likely, whether you want to continue to try to work with that toolchain and platform).




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

Search: