Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

(Where) Does clang document implementation-defined behavior?

Implementation-defined behaviors in C are unspecified behaviors for which each conforming implementation must document its choice.

I found such documentations easily for gcc here or Microsoft C here, but I can't find any such documentation for clang.

Am I searching wrong or is there no such thing?

like image 789
pwilke Avatar asked Mar 31 '16 13:03

pwilke


People also ask

Does clang define __ GNUC __?

(GNU C is a language, GCC is a compiler for that language. Clang defines __GNUC__ / __GNUC_MINOR__ / __GNUC_PATCHLEVEL__ according to the version of gcc that it claims full compatibility with.

How do you check for undefined behavior in C++?

However, it is possible to determine whether a specific execution of a C++ produced undefined behavior. One way to do this would be to make a C++ interpreter that steps through the code according to the definitions set out in the spec, at each point determining whether or not the code has undefined behavior.

Does clang use GCC?

Clang is compatible with GCC. Its command-line interface shares many of GCC's flags and options. Clang implements many GNU language extensions and compiler intrinsics, some of which are purely for compatibility.


1 Answers

This ticket https://bugs.llvm.org/show_bug.cgi?id=11272 is still opened (for many years now) so it seems that clang doesn't explicitly specify implementation defined behaviour.

For most cases I would bet that it's the same as GCC, though.

like image 56
dreamzor Avatar answered Oct 02 '22 14:10

dreamzor