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?
(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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With