On 12/04/14 23:38, Henrique de Moraes
Holschuh wrote:
I have no argument with that, in those places it is possible.On Thu, 10 Apr 2014, Shachar Shemesh wrote:I never did understand what people expect. gcc uses the undefinedWarn the hell out of any line of code with per-spec undefined behaviour, if not by default, at least under -Wall. I will point out that it is not always is possible, and is quite often not easy. For example, the famous "undefined after NULL dereference" would probably cause a warning every time a function uses a pointer it was given without first validating its non-NULLness. My understanding of things is that undefined behaviors are fairly common, and almost always benign. Look at the following code:THAT would be a good start. Too bad not even gcc knows every time it hits undefined behaviour... int add( int a, int b ) { return a+b; } Do you really want to get a "Warning: signed integer overflow yields undefined behavior" on this function? Shachar |