stdlib.h中的最小值/最大值?! [英] min/max in stdlib.h?!

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

问题描述

宏的min()和max()是否是stdlib.h的一部分? (根据

标准?)


我有以下问题:我定义了自己的min()/ max()宏,因为

我的编译器(MinGW)没有定义它们。当我尝试使用lcc-win32编译我的程序

时,编译器抱怨宏重新定义,因为

min()和max()在lcc'的stdlib中定义.h ..


那么这些宏是否属于那里?

Are the macros min() and max() part of stdlib.h or not? (according to the
standard?)

I have the following problem: I defined my own min() / max() macros because
my compiler (MinGW) does NOT define them. When I tried to compile my program
with lcc-win32 the compiler complained about macro redefinition, because
min() and max() are defined in lcc''s stdlib.h..

So do these macros belong there or not?

推荐答案

copx说:
copx said:

宏的min()和max()是不是stdlib.h的一部分? (根据

标准?)
Are the macros min() and max() part of stdlib.h or not? (according to the
standard?)



No.

No.


I有以下问题:我定义了我自己的min()/ max()宏

,因为我的编译器(MinGW)没有定义它们。当我尝试使用lcc-win32编译

我的程序时,编译器抱怨宏

重新定义,因为min()和max()在lcc'的stdlib中定义.h ..


那么这些宏是否属于那里?
I have the following problem: I defined my own min() / max() macros
because my compiler (MinGW) does NOT define them. When I tried to compile
my program with lcc-win32 the compiler complained about macro
redefinition, because min() and max() are defined in lcc''s stdlib.h..

So do these macros belong there or not?



不,他们不是。如果它们通过

实现放置在那里,请检查您是否在

符合模式下调用实现。如果是这样,那么你已经在

实现中发现了一个错误。


-

Richard Heathfield< http:/ /www.cpax.org.uk>

电子邮件:-http:// www。 + rjh @

谷歌用户:< http://www.cpax.org.uk/prg/writings/googly.php>

Usenet是一个奇怪的放置" - dmr 1999年7月29日

No, they don''t. If they are nevertheless placed there by the
implementation, check that you are invoking the implementation in
conforming mode. If so, then you have uncovered a bug in the
implementation.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999


copx写道:
copx wrote:

宏是min()和max()的一部分stdlib.h与否? (根据

标准?)


我有以下问题:我定义了自己的min()/ max()宏,因为

我的编译器(MinGW)没有定义它们。当我尝试使用lcc-win32编译我的程序

时,编译器抱怨宏重新定义,因为

min()和max()在lcc'的stdlib中定义.h ..


这些宏是否属于那里?
Are the macros min() and max() part of stdlib.h or not? (according to the
standard?)

I have the following problem: I defined my own min() / max() macros because
my compiler (MinGW) does NOT define them. When I tried to compile my program
with lcc-win32 the compiler complained about macro redefinition, because
min() and max() are defined in lcc''s stdlib.h..

So do these macros belong there or not?



No.

您是否以符合模式调用编译器?


-

Ian Collins。

No.

Did you invoke the compiler in conforming mode?

--
Ian Collins.

copx写道:
copx wrote:

宏的min()和max()是否是stdlib.h的一部分? (根据

标准?)


我有以下问题:我定义了自己的min()/ max()宏,因为

我的编译器(MinGW)没有定义它们。当我尝试使用lcc-win32编译我的程序

时,编译器抱怨宏重新定义,因为

min()和max()在lcc'的stdlib中定义.h ..


这些宏是否属于那里?
Are the macros min() and max() part of stdlib.h or not? (according to the
standard?)

I have the following problem: I defined my own min() / max() macros because
my compiler (MinGW) does NOT define them. When I tried to compile my program
with lcc-win32 the compiler complained about macro redefinition, because
min() and max() are defined in lcc''s stdlib.h..

So do these macros belong there or not?



他们不在标准中。

请注意,stdlib.h中的定义是:


#ifndef max

#define max(a,b)((( a)(b))?(a):( b))

#define min(a,b)(((a)<(b))?(a):( b) )

#endif


如果你在包括stdlib.h之前定义那些宏

将会被你的。此外,编译器只是

发出警告。


-

jacob navia

jacob at jacob point remcomp point fr

logiciels / informatique
http://www.cs.virginia.edu/~lcc-win32


这篇关于stdlib.h中的最小值/最大值?!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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