预处理器 [英] Preprocessor

查看:91
本文介绍了预处理器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你认为这对程序员的理智是否具有破坏性:


#define main Main

#define cout cerr

#define while(x)if(x)

#define class union

#define true 0

#define false 1


评论欢迎!!!

解决方案

Protoman写道:


评论欢迎!!!


我完全不知道那是什么,但如果你喜欢

评论你有我的: - )

#define while(x)if(x)




这里你不能阻止程序员使用表达式

结果在布尔值方面没有任何意义。


干杯

-

Mateusz ?? oskot
http://mateusz.loskot.net


#define while(x)if(x)表示预处理器将替换

if(x)for while(x)。


Protoman写道:

#define while(x)if(x)表示预处理器将替换
if(x)是否发生while(x)。




为什么?

你想做一些测试用例或什么?

干杯

-

Mateusz ?? oskot
http://mateusz.loskot.net


Would you consider this to be destructive to programmers'' sanity:

#define main Main
#define cout cerr
#define while(x) if(x)
#define class union
#define true 0
#define false 1

Comments welcome!!!

解决方案

Protoman wrote:


Comments welcome!!!

I completely have no idea what is that for but if you like
comments here you have mine :-)
#define while(x) if(x)



Here you can not prevent programmer to use expression
which result does not make any sense in term of boolean.

Cheers
--
Mateusz ??oskot
http://mateusz.loskot.net


#define while(x) if(x) means that the preprocessor will substitute
if(x) for any occurance of while(x).


Protoman wrote:

#define while(x) if(x) means that the preprocessor will substitute
if(x) for any occurance of while(x).



What for?
Do you want to do some test cases or what?
Cheers
--
Mateusz ??oskot
http://mateusz.loskot.net


这篇关于预处理器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆