Re: rand is not ISO C compliant in Cygwin
Corinna Vinschen <[email protected]>
| Newsgroups | gmane.comp.lib.newlib,gmane.os.cygwin |
|---|---|
| Message-ID | <[email protected]> |
On Nov 13 15:25, Bruno Haible wrote: > Corinna Vinschen wrote: > > The rand() function would still not use locking but AFAICS that's > > not actually required by POSIX or ISO C. > > Correct. Those who want an MT-safe rand-like function need to use random(), > not rand(). FTR, we have to differ here between plain newlib targets and Cygwin. While Cygwin comes with it's own, table-based random() implementation taken from BSD back in 2007, newlib's random is basically equivalent to rand() for the sake of bare-metal and other targets with high memory pressure. We shouldn't change the latter since multi-threading compliance is usually not much of a problem for that target audience. Corinna