question on using random in C on FC4 (perhaps slightly OT)

Andy Green andy at warmcat.com
Wed Nov 16 15:03:58 UTC 2005


STYMA, ROBERT E (ROBERT) wrote:

> For whatever reason, the declare for srandom in 
> /usr/include/stdlib.h is surrounded by the #ifdef
> 
> #if defined __USE_SVID || defined __USE_XOPEN_EXTENDED || defined __USE_BSD 

/usr/include/features.h has this

    163 /* If nothing (other than _GNU_SOURCE) is defined,
    164    define _BSD_SOURCE and _SVID_SOURCE.  */
    165 #if (!defined __STRICT_ANSI__ && !defined _ISOC99_SOURCE && \
    166      !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE && \
    167      !defined _XOPEN_SOURCE && !defined _XOPEN_SOURCE_EXTENDED && \
    168      !defined _BSD_SOURCE && !defined _SVID_SOURCE)
    169 # define _BSD_SOURCE    1
    170 # define _SVID_SOURCE   1
    171 #endif

That include also undefs __USE_BSD destroying the chance to use a -D for it.

Fact is that C99 defeats the prototypes for the BSD stuff for some reason.

Cut and paste the prototypes from stdlib.h into your code :-)

-Andy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 4492 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.fedoraproject.org/pipermail/users/attachments/20051116/2a64112f/attachment-0002.bin 


More information about the users mailing list