预处理器的输出是否确定? [英] Is the output of the preprocessor deterministic ?

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

问题描述

C预处理器的输出是否确定?我的意思

就是这样,给定2个符合相同标准的编译器,

他们的预处理器会产生相同的输出作为输入

同一个文件?如果没有,那么允许多少变化?是不是只需要或多或少的白色空间就可以或者可以

有更大的差异?


如果输出是不确定的,那么一个编译器的预处理器的输出可能无法被另一个编译器正确处理吗?

Spiros Bousbouras

Is the output of the C preprocessor deterministic ? What I mean
by that is , given 2 compilers which conform to the same standard,
will their preprocessors produce identical output given as input
the same file ? If not then how much variation is allowed ? Is it
just a bit more or less white space here and there or could could
there be larger differences ?

If the output is not deterministic then is it possible that the output
of the preprocessor of one compiler can not be processed correctly
by another compiler ?

Spiros Bousbouras

推荐答案


sp **** @ gmail.com 写道:
C预处理器的输出是否确定?我的意思是,给定2个符合相同标准的编译器,他们的预处理器会产生相同的输出作为输入同一个文件吗?如果没有,那么允许多少变化?它是否只是或多或少的空白区域或者可能会有更大的差异?

如果输出不确定,那么输出是否有可能一个编译器的预处理器无法正确处理
另一个编译器?
Is the output of the C preprocessor deterministic ? What I mean
by that is , given 2 compilers which conform to the same standard,
will their preprocessors produce identical output given as input
the same file ? If not then how much variation is allowed ? Is it
just a bit more or less white space here and there or could could
there be larger differences ?

If the output is not deterministic then is it possible that the output
of the preprocessor of one compiler can not be processed correctly
by another compiler ?




在黑暗中拍摄......


但是空格不应该阻止一个编译器使用来自竞争对手的输出




我想虽然你'会发现它不会是一样的。例如,

如果你在Linux盒子上使用GCC的cpp然后将它与MSVC的比较

会使输出不同,特别是因为标题是

本身就不一样了。


Tom



Shooting in dark...

But whitespace shouldn''t stop one compiler from working with the output
from a competitor.

I think though you''ll find it isn''t going to be the same. For example,
if you use cpp from GCC on a Linux box then compare it to what MSVC
would give the outputs will differ, especially since the headers
themselves are different.

Tom




Tom St Denis写道:

Tom St Denis wrote:
sp****@gmail.com 写道:
C预处理器的输出是否确定?我的意思是,给定2个符合相同标准的编译器,他们的预处理器会产生相同的输出作为输入同一个文件吗?如果没有,那么允许多少变化?它是否只是或多或少的空白区域或者可能会有更大的差异?

如果输出不确定,那么输出是否有可能一个编译器的预处理器无法正确处理
另一个编译器?
Is the output of the C preprocessor deterministic ? What I mean
by that is , given 2 compilers which conform to the same standard,
will their preprocessors produce identical output given as input
the same file ? If not then how much variation is allowed ? Is it
just a bit more or less white space here and there or could could
there be larger differences ?

If the output is not deterministic then is it possible that the output
of the preprocessor of one compiler can not be processed correctly
by another compiler ?



在黑暗中拍摄......

但是空格不应该阻止一个编译器使用来自竞争对手的输出。

我想虽然你会发现它不会是一样的。例如,如果您在Linux机器上使用GCC中的cpp,那么将它与MSVC相比,输出会有所不同,特别是因为标题
本身不同。



Shooting in dark...

But whitespace shouldn''t stop one compiler from working with the output
from a competitor.

I think though you''ll find it isn''t going to be the same. For example,
if you use cpp from GCC on a Linux box then compare it to what MSVC
would give the outputs will differ, especially since the headers
themselves are different.




我指定输入必须相同。由此我也意味着

相同的标题。



I specified that the input has to be the same. By that I also meant
same headers.


sp **** @ gmail.com 写道:

Tom St Denis写道:

Tom St Denis wrote:
我想虽然你会发现它不会是一样的。
I think though you''ll find it isn''t going to be the same.



我指定输入必须相同。由此我也意味着
相同的标题。


I specified that the input has to be the same. By that I also meant
same headers.




#include< stdio.h>


#ifdef putchar

#define STRING" putchar是一个宏

#else

#define STRING" putchar不是宏&br; />
#endif


-

pete



#include <stdio.h>

#ifdef putchar
#define STRING "putchar is a macro"
#else
#define STRING "putchar is not a macro"
#endif

--
pete


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

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