Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Feb 1997 18:09:43 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        bde@zeta.org.au, terry@lambert.org
Cc:        hackers@freebsd.org, proff@suburbia.net
Subject:   Re: grp.h
Message-ID:  <199702010709.SAA14153@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>Doesn't POSIX actually mandate "int" in some of the prototypes?

No.  It says that applications may redeclare the standard functions using
a declaration that is lexically identically to the one in the standard.
This means that either all arg types must be the same as their default
promotions, or the compiler must be ANSI.  BSD requires the latter.
For example, the following strictly POSIX conformant program does not
compile if the compiler isn't ANSI:

---
#define	_POSIX_SOURCE	1
#include <sys/types.h>
#include <sys/stat.h>
mode_t umask(mode_t);
int main(void) { return 1; }
----

because mode_t is u_int16_t (which promotes to int if ints have 16
bits and to unsigned otherwise) and <sys/stat.h> has declared umask()
incompatibly as `mode_t umask();' if the compiler is non-ANSI.  This
also prevents <sys/stat.h> from declaring umask() as `mode_t
umask(promotion_of_u_int16_t);' which may be required for the __P(())
hack to actually work - this would break the above program for ANSI
compilers.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199702010709.SAA14153>