I know that the #warning directive is not standard C/C++, but several compilers support it, including gcc/g++. But for those that don't support it, will they silently ignore it or will it result in a compile failure? In other words, can I safely use it in my project without breaking the build for compilers that don't support it?
C++ – Portability of #warning preprocessor directive
cc-preprocessorcompiler-constructionportabilitywarnings
Related Topic
- C++ – How ubiquitous is hash_map
- C++ – Why is this program erroneously rejected by three C++ compilers
- C++11 introduced a standardized memory model. What does it mean? And how is it going to affect C++ programming
- C++ – Define preprocessor macro through CMake
- Linux – Why does the C preprocessor interpret the word “linux” as the constant “1”
- C++ – Is #pragma once part of the C++11 standard
- C# – System.Windows.Application.GetResourceStream returns null
Best Answer
It should be noted that MSVC uses the syntax:
The usual #warning syntax generates a fatal error
so it is not portable to those compilers.