Reading the fine print of the -I switch in GCC, I'm rather shocked to find that using it on the command line overrides system includes. From the preprocessor docs
I use the __DATE__ macro for getting a compile-time year:The Clang Code Model in QtCreator throws a -Wdate-time warning for using the __DATE__ macro.
https://godbolt.org/z/cyBiWYI can see two 'some' literals in assembler code generated by MSVC, but only one with clang and gcc. This leads to totally different results of code execution.
https://godbolt.org/z/cyBiWYI can see two 'some' literals in assembler code generated by MSVC, but only one with clang and gcc. That results in a totally different results of code execution.
I get different answer between gcc and clangclang7.0.0 print out ,gcc8.2.0 gives the errorterminate called after throwing an instance of 'std::length_error' what(): cannot create std::vector larger than max_size()
With most C/C++ compilers, there's a flag passable to the compiler, -march=native, which tells the compiler to tune generated code for the micro-architecture and ISA extensions of the host CPU. Even if it doesn't go by the same name, there's typically an equivalent option for LLVM-based compilers, like rustc or...
code:In GCC compiler, working fine without any warning or error and printed output 8.But, in clang compiler, I got the following warning:
code:In GCC compiler, working fine without any warning or error and printed output 8.But, in clang compiler, i got following warning:
This question already has an answer here:While checking the return value of strcmp function, I found some strange behavior in gcc. Here's my code:
I wrote a singleton template class just like boost does:And I wrote the main function to test it.I know I mistyped Instance in ObjectCreator's constructor, the weird thing is I can compile it correctly by gcc-4.4.7, then I used clang-6.0, it hit me with the typo.