-std=c99 breaks include of getopt, random

Bug #35754 reported by Peter Berry
6
Affects Status Importance Assigned to Milestone
glibc (Ubuntu)
Invalid
Medium
Unassigned

Bug Description

According to getopt(3) and random(3), #include'ing unistd.h and stdlib.h should declare getopt() (and its associated globals) and random() respectively. This appears not to be the case:

[pwb@rhuidean c]$ gcc -std=c99 -o dice dice.c
dice.c: In function ‘usage’:
dice.c:26: error: ‘optopt’ undeclared (first use in this function)
dice.c:26: error: (Each undeclared identifier is reported only once
dice.c:26: error: for each function it appears in.)
dice.c: In function ‘getopts’:
dice.c:45: warning: implicit declaration of function ‘getopt’
dice.c:50: error: ‘optarg’ undeclared (first use in this function)
dice.c: In function ‘main’:
dice.c:86: warning: implicit declaration of function ‘random’

dice.c uses both. This is libc6-dev 2.3.5-1ubuntu12 on Breezy with gcc 4.0.1-3, gcc-4.0 4.0.1-4ubuntu9.

Revision history for this message
Peter Berry (pwberry) wrote :

oh and manpages-dev 2.02-2, in case this behaviour is correct.

Revision history for this message
Peter Berry (pwberry) wrote :

This bug is the same as https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=130815 - withdrawing, please see that bug for why.

Changed in glibc:
status: Unconfirmed → Rejected
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.