r/cprogramming • u/am_Snowie • Oct 16 '26
is doing ~INT_MAX undefined behavior?
/r/C_Programming/comments/1x7hxgd/is_doing_int_max_undefined_behavior/
5
Upvotes
r/cprogramming • u/am_Snowie • Oct 16 '26
View all comments
Show parent comment
1
u/MilkEnvironmental106 Oct 17 '26
It depends on what you are targeting. If the code is going to run on one machine you control, sure.
If you want your code to ever be used by anyone else, you need to make sure it does the same thing regardless of platform, which you can do by adhering to the standard.
Also staying within the standard means debugging is going to be far easier.