oneel@heawk1.rosserv.gsfc.nasa.gov ( Bruce Oneel ) (04/25/91)
Got a question on windows.h, bc++, and c++ mode. I was entering the sysmet? examples from the petzold book and I noticed that min and max weren't defined. That's funny, they're in help... Well, went spelunking through windows.h and noticed that they are in there, but if you are compiling c++ mode they are ignored. What do you know, to use my fetal windows classes, I've got to use c++ mode! Would some kind person explain why the min and max macros aren't defined when you are using c++ mode? I know how to make them defined but I assume that borland wouldn't have done the #if defs around them if there wasn't a good reason. I just wrote a few quick functions. Messy, but quick. bruce -- | Bruce O'Neel | internet : oneel@heasfs.gsfc.nasa.gov| | Code 664/STX | span : lheavx::oneel | | NASA/GSFC Bld 28/W281 |compuserve: 72737,1315 | | Greenbelt MD 20771 | AT&Tnet : (301)-286-4585 | Thats me in the corner, thats me in the spotlight, losin' my religion -- rem
bill@cbnewsl.att.com (william.clark) (04/25/91)
From article <ONEEL.91Apr25100347@heawk1.rosserv.gsfc.nasa.gov>, by oneel@heawk1.rosserv.gsfc.nasa.gov ( Bruce Oneel ): > Got a question on windows.h, bc++, and c++ mode. > > I was entering the sysmet? examples from the petzold book and I > noticed that min and max weren't defined. That's funny, they're in > help... Well, went spelunking through windows.h and noticed that they > are in there, but if you are compiling c++ mode they are ignored. > > Would some kind person explain why the min and max macros aren't > defined when you are using c++ mode? I would guess they are not included since C++ provides the "inline" mechanism which many prefer to #define. I suspect Borland is nudging you towards C++ conventions. -bill
cadsi@ccad.uiowa.edu (CADSI) (04/26/91)
From article <ONEEL.91Apr25100347@heawk1.rosserv.gsfc.nasa.gov>, by oneel@heawk1.rosserv.gsfc.nasa.gov ( Bruce Oneel ): > Got a question on windows.h, bc++, and c++ mode. > > I was entering the sysmet? examples from the petzold book and I > noticed that min and max weren't defined. That's funny, they're in > help... Well, went spelunking through windows.h and noticed that they > are in there, but if you are compiling c++ mode they are ignored. > What do you know, to use my fetal windows classes, I've got to use c++ > mode! > > Would some kind person explain why the min and max macros aren't > defined when you are using c++ mode? I know how to make them defined > but I assume that borland wouldn't have done the #if defs around them > if there wasn't a good reason. > > I just wrote a few quick functions. Messy, but quick. If you really want the min/max macros in C++, just do something like #if defined(__cpluscplus) # define min ... # define max ... #endif Alternatively, apply them as inline functions in a macrodef.h header or something. Note that if they are defined in C++, them min/max can't be used for overloading. For instance, min(string1, string2). |----------------------------------------------------------------------------| |Tom Hite | The views expressed by me | |Manager, Product development | are mine, not necessarily | |CADSI (Computer Aided Design Software Inc. | the views of CADSI. | |----------------------------------------------------------------------------|