Re: [scilab_dev] min and max C macros definition

classic Classic list List threaded Threaded
1 message Options
Allan CORNET-2 Allan CORNET-2
Reply | Threaded
Open this post in threaded view
|

Re: [scilab_dev] min and max C macros definition


Hi ,:)

#ifndef max
#define max ( a , b )            (((a ) > (b )) ? (a ) : (b ))
#endif

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

min and max are defined in <windef.h>

http://msdn2.microsoft.com/en-us/library/ms709458.aspx


Merry christmas :)


Allan

Le 01:34 PM 12/20/2007,alan écrit:
Hello,

I'm encountering some understanding in the compilation of scilab under windows
with min and max C macros :
In C routines of scicos we often use that macros and  in the scicos code I see
(in scicos_block.h for ie) :

#if WIN32
#undef min
#undef max
#endif

#ifndef WIN32
#define max(a,b) ((a) >= (b) ? (a) : (b))
#define min(a,b) ((a) <= (b) ? (a) : (b))
#endif

that clearly means that we undefine min and max for windows and we define
min/max with previous definition for all others platforms. But why ?

With more investigations, in most of computational routines of scicos blocks
where we need min and max, I can see that :

#ifndef min
#define min(a,b) ((a) <= (b) ? (a) : (b))
#endif

#ifndef max
#define max(a,b) ((a) >= (b) ? (a) : (b))
#endif

(that says :  if min/max not defined then use same definitions than the
first..!)

Is there somebody that can say to me if there is special definition of min/max
somewhere in the scilab C header(.h) for windows or in the standard C windows
include files ?

Thanks,
Alan



==============================================
Allan CORNET
Scilab Consortium
http://www.scilab.org
INRIA - Unité de Recherche de Rocquencourt
Domaine de Voluceau - B.P. 105
78153 Le Chesnay Cedex

==============================================
Projet Scilab
Bâtiment 1B - Bureau 009
Email : [hidden email]
==============================================