开发者

Is there something wrong in #define and &&

I wonder if this would be a bad idea to makes such defines in C:

#define and &&
#define or  ||
#def开发者_StackOverflow社区ine not !


It would definitely be a bad idea to do this yourself.

If you really want names like and instead of symbols like &&, you can include the <iso646.h> C Standard Library header, which defines several named operators, including the three you mention.

In C++, the alternative representations (like and and or) are operators built into the language, so you don't need to include any header to use them, and it isn't possible to define them as macros (a macro name must be an identifier, and the alternative representations are operators, not identifiers, even during preprocessing).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜