NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lib/39215: getdevmajor()/major() types don't match



On Aug 1,  1:10pm, M.Drochner%fz-juelich.de@localhost (Matthias Drochner) wrote:
-- Subject: Re: lib/39215: getdevmajor()/major() types don't match

| The following reply was made to PR lib/39215; it has been noted by GNATS.
| 
| From: Matthias Drochner <M.Drochner%fz-juelich.de@localhost>
| To: christos%zoulas.com@localhost (Christos Zoulas)
| Cc: gnats-bugs%NetBSD.org@localhost, lib-bug-people%NetBSD.org@localhost,
|       gnats-admin%NetBSD.org@localhost, netbsd-bugs%NetBSD.org@localhost
| Subject: Re: lib/39215: getdevmajor()/major() types don't match 
| Date: Fri, 01 Aug 2008 15:04:56 +0200
| 
|  christos%zoulas.com@localhost said:
|  > Unless you assume that the major fits in 31 bits.
|  
|  Wouldn't that be reasonable? Forcing 32-bit CPUs
|  to do quad arithmetics on devsw lookups etc would
|  be a bit wasteful...

No, it wouldn't be unreasonable. I just think that libc interfaces
should use typed return values as opposed to plain integral types
where appropriate, and constant defines to indicate exceptional
conditions. So I prefer to have:

    dev_t getdevmajor(const char *name, mode_t mode);

    if ((dev = getdevmajor("foo", S_IFCHR)) == NODEV)

as opposed to:

    int getdevmajor(const char *name, mode_t mode);

    if ((dev = getdevmajor("foo", S_IFCHR)) == -1)

christos


Home | Main Index | Thread Index | Old Index