Hacker Newsnew | past | comments | ask | show | jobs | submit | ouah's commentslogin

"Incidentally, it is a common misconception that if c is a character variable, one can obtain the unsigned integer equivalent of c by writing (unsigned) c. This fails because a char quantity is converted to int before any operator is applied to it, even a cast. Thus c is converted first to a signed integer and then to an unsigned integer, with possibly unexpected results."

The "even a cast" part is wrong. The usual arithmetic conversions (including the integer promotion) is not done with the cast operation in C.


The case of typeof has already been discussed for C99 and it has been rejected. In ISO C99 Rationale document (section 6.7.7), it is written: "A proposed typeof operator was rejected on the grounds of insufficient utility." Don't forget most of the work of the C committee is spent in resisting features suggestions.


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

Search: