Hacker News new | ask | show | jobs
by userbinator 3652 days ago
Although I guess you could just rely on promotion here if you can rely on the unsignedness of char

If compilers did not do promotion, they would be very obviously not compliant with the C standard and unable to compile correctly most existing code, so I'm willing to bet that is something you can rely on. It's defined by the standard and widely used.

1 comments

Sure, but in this case it was signed to unsigned promotion.
Why should that matter in this case? The worst case would have been the output of a wrong value and it was some commented out debug output which I have used in a very specific case.
Totally, just wrong value. This thread is already making a bigger deal of it than I expected it to.