Home >Backend Development >C++ >How do I determine the default C standard used by g ?

How do I determine the default C standard used by g ?

Patricia Arquette
Patricia ArquetteOriginal
2024-11-12 07:53:01211browse

How do I determine the default C   standard used by g  ?

Determining the Default C Standard in g

When compiling C code using g , the default C standard is automatically selected by the compiler. This default standard varies depending on the g version used. If a specific C standard is not explicitly specified during compilation, g will use its internal default.

To determine the default C standard used by g , follow these steps:

g++ -dM -E -x c++ /dev/null | grep -F __cplusplus

For example, if your g version is 4.8.4, you will get the following output:

#define __cplusplus 199711L

This output indicates that the default C standard used by g 4.8.4 is C 11.

Additional Considerations

  • For versions of g earlier than 4.7, the -dM option is not supported, and you cannot explicitly determine the default C standard.
  • In most cases, it is recommended to explicitly specify the desired C standard using the -std= option during compilation. This ensures that your code is compiled using the specific standard you intended.
  • Always refer to the official g documentation for the most up-to-date information on supported C standards.

The above is the detailed content of How do I determine the default C standard used by g ?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn