Hacker News new | past | comments | ask | show | jobs | submit login

Don't think anyone has mentioned this:

bool is also subject to integer promotion so when you pass a bool to a function or do some integer arithmetic it can become an int.

From the text K&R, C Programming Language, 2nd Ed. p. 174

A.6.1 Integral Promotion

A character, a short integer, or an integer bit-field, all either signed or not, or an object of enumeration type, may be used in an expression wherever an integer may be used. If an int can represent all the values of the original type, then the value is converted to int; otherwise the value is converted to unsigned int. This process is called integral promotion.




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

Search: