C doesn't have a bool? Also VS2010 question

前端 未结 6 1829
礼貌的吻别
礼貌的吻别 2021-01-12 16:17

I\'m using VS 2010 Pro.

First, C doesn\'t have a bool type? I just have to use int with 0/1. Seems odd as most languages consider boolean a standard type.

6条回答
  •  无人共我
    2021-01-12 16:45

    See R.'s answer for information about the bool type.

    Unfortunately, MSVC doesn't support C99 when it's compiling C code - it has bits and pieces (generally things in the C99 library that are required by C++), but for the most part it only supports C90.

    As for bool still being highlighted in the editor - the highlighting in MSVC may be sophisticated, but it doesn't take into account the differentiation between C, C++, and C++/CLI. For example, if you use a construct that's CLI-only, it'll be highlighted as such even if your project has nothing to do with CLI.

提交回复
热议问题