Portability of #warning preprocessor directive

前端 未结 6 1661
孤独总比滥情好
孤独总比滥情好 2020-11-29 10:47

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 t

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-29 11:30

    It should be noted that MSVC uses the syntax:

    #pragma message ( "your warning text here" )
    

    The usual #warning syntax generates a fatal error

    C1021: invalid preprocessor command 'warning'
    

    so it is not portable to those compilers.

提交回复
热议问题