Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Apr 2001 08:24:48 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Peter Pentchev <roam@orbitel.bg>
Cc:        arch@FreeBSD.ORG
Subject:   Re: gid_t vs. plain int
Message-ID:  <Pine.BSF.4.21.0104260813260.27478-100000@besplex.bde.org>
In-Reply-To: <20010425183640.C54687@ringworld.oblivion.bg>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 25 Apr 2001, Peter Pentchev wrote:

> Is there a reason that struct group in <group.h> does not define 'gr_gid'
> as a gid_t value, but as a plain int?  This makes all kinds of things

Historical reasons, and because wollman still hasn't committed his header
cleanups which fix this and many other related problems.

> go berserk with gcc -Wall -W, and causes dozens of (totally unneeded)
> casts.

The casts might be needed to support K&R compilers on systems with
sizeof(gid_t) < sizeof(int), but mostly make things worse by hiding
bugs.

> Is there some standard that says pw_gid is gid_t, but gr_gid is int?

POSIX.1-1990 says that both are gid_t.

BTW, the kernel still uses int for gids in many places, e.g.,
kern/syscalls.master says that chown(2) takes an "int gid" arg.  This
depends on various type puns to work.  Similarly for many other syscall
args.

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0104260813260.27478-100000>