Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!ns-mx!ccad.uiowa.edu!cadsi From: cadsi@ccad.uiowa.edu (CADSI) Newsgroups: comp.windows.ms.programmer Subject: Re: min/max in bc++ Message-ID: <1991Apr25.172239.23456@ccad.uiowa.edu> Date: 25 Apr 91 17:22:39 GMT References: Distribution: comp Organization: CAD-Research, U. of Iowa, Iowa City, Iowa Lines: 33 From article , 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. | |----------------------------------------------------------------------------|