[scilab_dev] min and max C macros definition
Allan CORNET
allan.cornet at inria.fr
Thu Dec 20 14:35:31 CET 2007
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 : allan.cornet at inria.fr
==============================================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/dev/attachments/20071220/d97d1b1f/attachment.htm>
More information about the dev
mailing list