Macro defintion of max?

Discussion regarding the development of CEGUI itself - as opposed to questions about CEGUI usage that should be in the help forums.

Moderators: CEGUI MVP, CEGUI Team

User avatar
pokemoen
Not too shy to talk
Not too shy to talk
Posts: 27
Joined: Thu Mar 10, 2005 10:55
Contact:

Macro defintion of max?

Postby pokemoen » Fri Feb 17, 2006 13:11

CEGUIBase.h

Code: Select all

00063 // Detect macros for min / max and undefine (with a warning where possible)
00064 #if defined(max)
00065 #   if defined(_MSC_VER)
00066 #       pragma message("Macro defintion of max detected - undefining")
00067 #   elif defined (__GNUC__)
00068 #       warning ("Macro defintion of max detected - undefining")
00069 #   endif
00070 #   undef max
00071 #endif
00072 #if defined(min)
00073 #   if defined(_MSC_VER)
00074 #       pragma message("Macro defintion of min detected - undefining")
00075 #   elif defined (__GNUC__)
00076 #       warning ("Macro defintion of min detected - undefining")
00077 #   endif
00078 #   undef min
00079 #endif


1st: What is a "defintion"? ;)
2nd: Why am I getting this message exactly? I don't know when this check was added, but I didn't get the warnings before.. What could I have changed to start defining min and max?

Just curious..

TIA!
Alex

User avatar
Dalfy
CEGUI Team (Retired)
Posts: 130
Joined: Tue Oct 11, 2005 16:13
Location: Paris, FRANCE
Contact:

Postby Dalfy » Fri Feb 17, 2006 14:59

a definition is a preprocessor command of the form

Code: Select all

#define var value.


The preprocessor will make use of this definition and substitute every where in the code var by value. There is possibly to kind of definition:
macro and constant.

For a detailed description of the preprocessor you might have a look on any book on C or look foward cpp on google.

User avatar
pokemoen
Not too shy to talk
Not too shy to talk
Posts: 27
Joined: Thu Mar 10, 2005 10:55
Contact:

Postby pokemoen » Fri Feb 17, 2006 21:55

I know what a definition is, read carefully ;)

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Postby lindquist » Sat Feb 18, 2006 01:45

hehe. a little type we have :P

You're seeing this because of some M$ stupidity there min and max are defined as macros.

min, max are so common names that this is truely dumb. therefore cegui removes these definitions if found.

HTH

[edit] I have fixed this typo in CVS head btw [/edit]

User avatar
pokemoen
Not too shy to talk
Not too shy to talk
Posts: 27
Joined: Thu Mar 10, 2005 10:55
Contact:

Postby pokemoen » Sun Feb 19, 2006 17:47

Okay, cool, thanks :)

User avatar
baxissimo
Quite a regular
Quite a regular
Posts: 60
Joined: Tue Feb 22, 2005 08:04
Location: Tokyo, JAPAN
Contact:

Re: Macro defintion of max?

Postby baxissimo » Thu Mar 16, 2006 14:19

pokemoen wrote:2nd: Why am I getting this message exactly? I don't know when this check was added, but I didn't get the warnings before.. What could I have changed to start defining min and max?


It might have also started to appear because either you or CEGUI changed the order in which some headers are included. If Microsoft's header gets included after CEGUI then you won't get the message. If before, then you will.

User avatar
muhkuh
Not too shy to talk
Not too shy to talk
Posts: 22
Joined: Wed Jan 12, 2005 12:06

Re: Macro defintion of max?

Postby muhkuh » Sat May 27, 2006 13:47

baxissimo wrote:
pokemoen wrote:2nd: Why am I getting this message exactly? I don't know when this check was added, but I didn't get the warnings before.. What could I have changed to start defining min and max?


It might have also started to appear because either you or CEGUI changed the order in which some headers are included. If Microsoft's header gets included after CEGUI then you won't get the message. If before, then you will.


This happened serveral times for me so I put a NOMINMAX preprocessor definition in every visual studio project of CEGUI. May be this could be applied to svn trunk so it's more robust when the order of included headers changes?


Return to “CEGUI Library Development Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest