Is max(a,b) defined in stdlib.h or not?

后端 未结 5 720
旧时难觅i
旧时难觅i 2021-02-04 00:55

I\'m using two computers, each with a different version of visual studio. On the visual studio 2008 computer my code compiles. On the visual 2010 computer my code doesn\'t compi

5条回答
  •  心在旅途
    2021-02-04 01:38

    So answering your main question:

    Is max(a,b) defined in stdlib.h or not?

    No it isn't, it's defined in windef.h around line 187:

    #ifndef NOMINMAX
    
    #ifndef max
    #define max(a,b)            (((a) > (b)) ? (a) : (b))
    #endif
    
    #ifndef min
    #define min(a,b)            (((a) < (b)) ? (a) : (b))
    #endif
    
    #endif  /* NOMINMAX */
    

提交回复
热议问题