home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c      Meh, in C you gotta define EVERYTHING      243,242 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 242,958 of 243,242   
   John McCue to Michael Sanders   
   Re: OS Macros   
   11 Jan 26 23:53:00   
   
   From: jmclnx@gmail.com.invalid   
      
   Michael Sanders  wrote:   
   > Any you'd add to this list?   
   >   
   > #ifdef __OpenBSD__   
      
      
   The program below was created over a long period of time.   
      
   It has all defines I have run across on Various OSs.   
      
   START=========================================   
   /*   
   prints various min/max sizes for various items   
   also has defines   
   */   
   #ifndef COHERENT   
   #ifndef _MSDOS   
   #include    
   #endif   
   #endif   
      
   #include    
   #include    
   #include    
   #ifndef LDBL_MAX   
   #include    
   #endif   
      
   /* PATH_PAX is the one to use */   
   #ifdef MAXPATHLEN   
   #ifndef PATH_MAX   
   #define PATH_MAX MAXPATHLEN   
   #endif   
   #else   
   #ifdef PATH_MAX   
   #define MAXPATHLEN PATH_MAX   
   #endif   
   #endif   
      
   #define UL  "------------------------------------------------------\n"   
   #define DUL "======================================================\n"   
      
   void print_system()   
   {   
     int found = 0;   
      
   #if defined(__LP64__)   
     printf("Is 64 BIT\n");   
   #else   
   #ifndef _MSDOS   
     printf("Is 32 BIT\n");   
   #endif   
   #endif   
   printf("%s\n", DUL);   
      
   #ifdef COHERENT   
     printf("Is Coherent: COHERENT   = %d\n", COHERENT);   
     found++;   
   #endif   
      
   #ifdef _MSDOS   
     printf("Is MS-DOS  : _MSDOS     = %d\n", _MSDOS);   
     found++;   
   #endif   
      
   #ifdef linux   
     printf("Is Linux: linux     = %d\n", linux);   
     found++;   
   #endif   
      
   #ifdef _AIX   
     printf("Is AIX: _AIX  = %d\n", _AIX);   
     found++;   
   #endif   
      
   #ifdef __FreeBSD_version   
     printf("Is FreeBSD: __FreeBSD_version = %d\n", __FreeBSD_version);   
     found++;   
   #endif   
      
   #ifdef __NetBSD_Version__   
     printf("Is NetBSD: __NetBSD_Version__ = %d\n", __NetBSD_Version__);   
     found++;   
   #endif   
      
   #ifdef OpenBSD   
     printf("Is OpenBSD: OpenBSD = %d\n", OpenBSD);   
     found++;   
   #endif   
      
     if (found < 1)   
       printf("***** UNKNOWN SYSTEM\n");   
      
     fprintf(stdout, DUL);   
      
   } /* print_system() */   
      
   int main()   
   {   
     print_system();   
      
     /* PATH */   
     fprintf(stdout, DUL);   
     fprintf(stdout, "Max PATH / File Name\n");   
     fprintf(stdout, UL);   
   #ifdef PATH_MAX   
     fprintf(stdout, "%d\n", PATH_MAX);   
   #else   
     fprintf(stdout, "Need to find PATH_MAX\n");   
      
   #endif   
     fprintf(stdout, DUL);   
      
     /* CHAR */   
     fprintf(stdout, DUL);   
     fprintf(stdout, "char min\n");   
     fprintf(stdout, UL);   
   #ifdef SCHAR_MIN   
     fprintf(stdout, "%d\n", SCHAR_MIN);   
   #else   
     fprintf(stdout, "Need to find SCHAR_MIN\n");   
   #endif   
     fprintf(stdout, DUL);   
     fprintf(stdout, "char max\n");   
     fprintf(stdout, UL);   
   #ifdef SCHAR_MAX   
     fprintf(stdout, "%d\n", SCHAR_MAX);   
   #else   
     fprintf(stdout, "Need to find SCHAR_MAX\n");   
   #endif   
     fprintf(stdout, DUL);   
     fprintf(stdout, "unsigned char max\n");   
     fprintf(stdout, UL);   
   #ifdef UCHAR_MAX   
     fprintf(stdout, "%d\n", UCHAR_MAX);   
   #else   
     fprintf(stdout, "Need to find UCHAR_MAX\n");   
   #endif   
      
     /*  short int */   
     fprintf(stdout, DUL);   
     fprintf(stdout, "short min\n");   
     fprintf(stdout, UL);   
   #ifdef SHRT_MIN   
     fprintf(stdout, "%d\n", SHRT_MIN);   
   #else   
     fprintf(stdout, "need to find SHRT_MIN\n");   
   #endif   
     fprintf(stdout, DUL);   
     fprintf(stdout, "unsigned short max\n");   
     fprintf(stdout, UL);   
   #ifdef SHRT_MAX   
     fprintf(stdout, "%d\n", SHRT_MAX);   
   #else   
     fprintf(stdout, "need to find SHRT_MAX\n");   
   #endif   
     fprintf(stdout, "unsigned short max\n");   
     fprintf(stdout, UL);   
   #ifdef USHRT_MAX   
     fprintf(stdout, "%d\n", USHRT_MAX);   
   #else   
     fprintf(stdout, "need to find USHRT_MAX\n");   
   #endif   
     fprintf(stdout, DUL);   
      
     /*  int */   
     fprintf(stdout, DUL);   
     fprintf(stdout, "int min\n");   
     fprintf(stdout, UL);   
   #ifdef INT_MIN   
     fprintf(stdout, "%d\n", INT_MIN);   
   #else   
     fprintf(stdout, "need to find INT_MIN\n");   
   #endif   
     fprintf(stdout, DUL);   
     fprintf(stdout, "int max\n");   
     fprintf(stdout, UL);   
   #ifdef INT_MAX   
     fprintf(stdout, "%d\n", INT_MAX);   
   #else   
     fprintf(stdout, "need to find INT_MAX\n");   
   #endif   
      
     /* unsigned int */   
     fprintf(stdout, DUL);   
     fprintf(stdout, "unsigned int max\n");   
     fprintf(stdout, UL);   
   #ifdef UINT_MAX   
     fprintf(stdout, "%u\n", UINT_MAX);   
   #else   
     fprintf(stdout, "need to find UINT_MAX\n");   
   #endif   
     fprintf(stdout, DUL);   
      
     /*  long */   
     fprintf(stdout, DUL);   
     fprintf(stdout, "long min\n");   
     fprintf(stdout, UL);   
   #ifdef LONG_MIN   
     fprintf(stdout, "%ld\n", LONG_MIN);   
   #else   
     fprintf(stdout, "need to find LONG_MIN\n");   
   #endif   
     fprintf(stdout, DUL);   
     fprintf(stdout, "long max\n");   
     fprintf(stdout, UL);   
   #ifdef LONG_MAX   
     fprintf(stdout, "%ld\n", LONG_MAX);   
   #else   
     fprintf(stdout, "need to find LONG_MAX\n");   
   #endif   
     fprintf(stdout, DUL);   
      
     /*  long long */   
     fprintf(stdout, DUL);   
     fprintf(stdout, "long long min\n");   
     fprintf(stdout, UL);   
   #ifdef LLONG_MIN   
     fprintf(stdout, "%lld\n", LLONG_MIN);   
   #else   
     fprintf(stdout, "need to find LLONG_MIN\n");   
   #endif   
     fprintf(stdout, DUL);   
     fprintf(stdout, "long long min\n");   
     fprintf(stdout, UL);   
   #ifdef LLONG_MAX   
     fprintf(stdout, "%lld\n", LLONG_MAX);   
   #else   
     fprintf(stdout, "need to find LLONG_MAX\n");   
   #endif   
      
     fprintf(stdout, DUL);   
     fprintf(stdout, "unsigned long long max\n");   
     fprintf(stdout, UL);   
   #ifdef ULLONG_MAX   
     fprintf(stdout, "%llu\n", ULLONG_MAX);   
   #else   
     fprintf(stdout, "need to find ULLONG_MAX\n");   
   #endif   
      
     /*  DOUBLE */   
     fprintf(stdout, DUL);   
     fprintf(stdout, "float min\n");   
     fprintf(stdout, UL);   
   #ifdef FLT_MAX   
     fprintf(stdout, "%f\n", -FLT_MAX);   
   #else   
     fprintf(stdout, "need to find FLT_MIN\n");   
   #endif   
     fprintf(stdout, DUL);   
     fprintf(stdout, "float max\n");   
     fprintf(stdout, UL);   
   #ifdef FLT_MAX   
     fprintf(stdout, "%f\n", FLT_MAX);   
   #else   
     fprintf(stdout, "need to find FLT_MAX\n");   
   #endif   
     fprintf(stdout, DUL);   
      
      
     /*  DOUBLE */   
     fprintf(stdout, DUL);   
     fprintf(stdout, "double min\n");   
     fprintf(stdout, UL);   
   #ifdef DBL_MAX   
     fprintf(stdout, "%lf\n", -DBL_MAX);   
   #else   
     fprintf(stdout, "need to find DBL_MIN\n");   
   #endif   
     fprintf(stdout, DUL);   
     fprintf(stdout, "double max\n");   
     fprintf(stdout, UL);   
   #ifdef DBL_MAX   
     fprintf(stdout, "%lf\n", DBL_MAX);   
   #else   
     fprintf(stdout, "need to find DBL_MAX\n");   
   #endif   
     fprintf(stdout, DUL);   
      
     /* LONG DOUBLE */   
     fprintf(stdout, DUL);   
     fprintf(stdout, "long double min\n");   
     fprintf(stdout, UL);   
   #ifdef LDBL_MAX   
   #ifdef _MSDOS   
     fprintf(stdout, "MS-DOS crashes printing -LDBL_MAX\n");   
   #else   
     fprintf(stdout, "%Lf\n", -LDBL_MAX);   
   #endif   
   #else   
     fprintf(stdout, "need to find LDBL_MIN\n");   
   #endif   
      
     fprintf(stdout, DUL);   
     fprintf(stdout, "long double max\n");   
     fprintf(stdout, UL);   
   #ifdef LDBL_MAX   
   #ifdef _MSDOS   
     fprintf(stdout, "MS-DOS crashes printing LDBL_MAX\n");   
   #else   
     fprintf(stdout, "%Lf\n", LDBL_MAX);   
   #endif   
   #else   
     fprintf(stdout, "need to find LDBL_MAX\n");   
   #endif   
     fprintf(stdout, DUL);   
      
     return(0);   
      
   }   
   END  =========================================   
      
   --   
   [t]csh(1) - "An elegant shell, for a more... civilized age."   
                           - Paraphrasing Star Wars   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca