Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get list of supported standards in Clang?

Tags:

clang

I found this in MAN:

   -std=language
       Specify the language standard to compile for.

   -ansi
       Same as -std=c89.

But where to find the list of all supported standards by my installed compiler?

clang -std=??? test.c
like image 831
exebook Avatar asked Feb 19 '14 03:02

exebook


People also ask

Does Clang support C++17?

You can use Clang in C++17 mode with the -std=c++17 option (use -std=c++1z in Clang 4 and earlier).

What is clang11?

Clang is a compiler front end for the C, C++, Objective-C, and Objective-C++ programming languages, as well as the OpenMP, OpenCL, RenderScript, CUDA, and HIP frameworks. It acts as a drop-in replacement for the GNU Compiler Collection (GCC), supporting most of its compilation flags and unofficial language extensions.

Is Clang better than GCC?

Clang is much faster and uses far less memory than GCC. Clang aims to provide extremely clear and concise diagnostics (error and warning messages), and includes support for expressive diagnostics. GCC's warnings are sometimes acceptable, but are often confusing and it does not support expressive diagnostics.

Does Clang support variable length arrays?

However, Clang supports such variable length arrays for compatibility with GNU C and C99 programs. If you would prefer not to use this extension, you can disable it with -Werror=vla.


1 Answers

Just specify any BS standard and clang will print those acceptable like so:

c:\LLVM\bin>clang++.exe -std=blabla main.cpp
error: invalid value 'blabla' in '-std=blabla'
note: use 'c++98' or 'c++03' for 'ISO C++ 1998 with amendments' standard
note: use 'gnu++98' or 'gnu++03' for 'ISO C++ 1998 with amendments and GNU extensions' standard
note: use 'c++11' for 'ISO C++ 2011 with amendments' standard
note: use 'gnu++11' for 'ISO C++ 2011 with amendments and GNU extensions' standard
note: use 'c++14' for 'ISO C++ 2014 with amendments' standard
note: use 'gnu++14' for 'ISO C++ 2014 with amendments and GNU extensions' standard
note: use 'c++17' for 'ISO C++ 2017 with amendments' standard
note: use 'gnu++17' for 'ISO C++ 2017 with amendments and GNU extensions' standard
note: use 'c++2a' for 'Working draft for ISO C++ 2020' standard
note: use 'gnu++2a' for 'Working draft for ISO C++ 2020 with GNU extensions' standard

;-)

like image 112
Artur Avatar answered Sep 21 '22 15:09

Artur