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,924 of 243,242   
   Keith Thompson to Michael Sanders   
   Re: srand(0)   
   08 Jan 26 22:46:42   
   
   From: Keith.S.Thompson+u@gmail.com   
      
   Michael Sanders  writes:   
   > On Thu, 08 Jan 2026 14:44:27 -0800, Keith Thompson wrote:   
   >> Michael Sanders  writes:   
   [...]   
   >>> So then clang would use:   
   >>>   
   >>> #ifdef __OpenBSD__   
   >>>     srand_deterministic(seed);   
   >>> #else   
   >>>     srand(seed);   
   >>> #endif   
   >>>   
   >>> But I don't know (yet) that gcc does as well under OpenBSD.   
   >>   
   >> I don't know what you mean when you say that clang "would use"   
   >> that code.   
   >>   
   >> I'm not aware that either clang or gcc uses random numbers   
   >> internally.  I don't know why they would.   
   >   
   > Well, I meant the macro itself is (I'm guessing) probably defined   
   > by clang since its the default compiler.   
      
   You mean the macro __OpenBSD__?  Yes, that and other similar macros   
   are predefined by the compiler, which is configured for each OS.   
   gcc on OpenBSD also predefines it.  (I don't know whether it's   
   predefined by the preprocessor directly or by some header that's   
   included implicitly.  That doesn't really matter.)  Compilers on   
   other platforms will not predefine __OpenBSD__.   
      
   But your original statement implied that clang would *use* that   
   particular piece of code, which didn't make much sense.  Were you   
   just asking about how the __OpenBSD__ macro is defined, without   
   reference to srand?   
      
   [...]   
      
   --   
   Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com   
   void Void(void) { Void(); } /* The recursive call of the void */   
      
   --- 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