top | item 47044262

(no title)

deathanatos | 12 days ago

> undefined behavior makes debugging intractable:

By their own admission, the compiler warns about the UB. "-Wanal"¹, as some call it, makes it an error. Under UBSan the program aborts with:

  code.cpp:4:6: runtime error: execution reached the end of a value-returning function without returning a value
… "intractable"?

¹a humorous name for -Wextra -Wall -Werror

discuss

order

zephen|12 days ago

Not everybody has full control over their environment.

The -Werror flag is not even religiously used for building, e.g. the linux kernel, and -Wextra can introduce a lot of extraneous garbage.

This will often make it easier (though still difficult) to winnow the program down to a smaller example, as that person did, rather than to enable everything and spend weeks debugging stuff that isn't the actual problem.

uecker|12 days ago

Yes, this is the funny thing. People do not want to spend time using a stricter language as already supported by C compilers using compiler flags because "it is waste of time" while others argue that we need to switch to much stricter languages. Both positions can not be true at the same time.