它只是我还是只是微软? [英] Is it just me or just Microsoft?

查看:54
本文介绍了它只是我还是只是微软?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于特殊需求(代码检测),我遇到了Visual Studio 6.0和2005的意外

行为(做同样的事情):


#include< stdio.h>

#define CAT1(a,b)a ## b

#define CAT(a,b)CAT1(a,b)

#define MYNUM(n)CAT(n,__ LINE__)

const int x = MYNUM(35); //好的

int z = MYNUM(78); // OK

int main(int argc)

{

static int y = MYNUM(21); //错误!

//6.0:错误C2064:术语无法评估函数

// 2005添加:取26451848个参数。


printf("%d%d \ n",x,y);

返回0;

}


无论我编译为C还是C ++都没关系(如果我没弄错的话,

预处理器是相同的)。

没有问题的另一个编译器(ARM的IAR)...

[微软声称C ++部门严格遵守标准]


有什么建议吗?

谢谢,

方舟

解决方案



Ark Khasin < ak ***** @ macroexpressions.comwrote in message

news:Pbfmi.4059


7R4.1870@trndny09 ...


由于特殊需求(代码检测),我遇到了Visual Studio 6.0和2005的意外

行为(做同样的事情):


#include< stdio.h>

#define CAT1(a,b)a ## b

#define CAT(a ,b)CAT1(a,b)

#define MYNUM(n)CAT(n,__ LINE__)

const int x = MYNUM(35); //好的

int z = MYNUM(78); // OK

int main(int argc)

{

static int y = MYNUM(21); //错误!

//6.0:错误C2064:术语无法评估函数

// 2005添加:取26451848个参数。


printf("%d%d \ n",x,y);

返回0;

}


无论我编译为C还是C ++都没关系(如果我没弄错的话,

预处理器是相同的)。

没有问题与另一个编译器(ARM的IAR)...

[微软声称C ++部门严格遵守标准]


有什么建议吗?



是的,购买符合ANSI / ISO标准的编译器


>

谢谢,

方舟



GeekBoy写道:
< blockquote class =post_quotes>
" Ark Khasin" < ak ***** @ macroexpressions.com写信息

新闻:Pbfmi.4059


Due to a peculiar need (code instrumentation) I came across unexpected
behavior of Visual Studio 6.0 and 2005 (doing the same thing):

#include <stdio.h>
#define CAT1(a,b) a ## b
#define CAT(a,b) CAT1(a,b)
#define MYNUM(n) CAT(n,__LINE__)
const int x = MYNUM(35); //OK
int z=MYNUM(78); //OK
int main(int argc)
{
static int y=MYNUM(21); //error!
//6.0: error C2064: term doesn''t evaluate to a function
//2005 adds: taking 26451848 arguments.

printf("%d %d\n", x, y );
return 0;
}

Doesn''t matter if I compile as C or as C++ (if I am not mistaken, the
preprocessor is the same).
No problem with another compiler (IAR for ARM)...
[Microsoft claims strict standard compliance in the C++ department]

Any suggestions?

Thank you,
Ark

解决方案


"Ark Khasin" <ak*****@macroexpressions.comwrote in message
news:Pbfmi.4059


7R4.1870@trndny09...

Due to a peculiar need (code instrumentation) I came across unexpected
behavior of Visual Studio 6.0 and 2005 (doing the same thing):

#include <stdio.h>
#define CAT1(a,b) a ## b
#define CAT(a,b) CAT1(a,b)
#define MYNUM(n) CAT(n,__LINE__)
const int x = MYNUM(35); //OK
int z=MYNUM(78); //OK
int main(int argc)
{
static int y=MYNUM(21); //error!
//6.0: error C2064: term doesn''t evaluate to a function
//2005 adds: taking 26451848 arguments.

printf("%d %d\n", x, y );
return 0;
}

Doesn''t matter if I compile as C or as C++ (if I am not mistaken, the
preprocessor is the same).
No problem with another compiler (IAR for ARM)...
[Microsoft claims strict standard compliance in the C++ department]

Any suggestions?


Yeah, buy a compiler that is ANSI/ISO compliant

>
Thank you,
Ark



GeekBoy wrote:

"Ark Khasin" <ak*****@macroexpressions.comwrote in message
news:Pbfmi.4059


这篇关于它只是我还是只是微软?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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