Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 May 1999 09:26:46 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        bde@zeta.org.au, grog@lemis.com
Cc:        cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org, phk@FreeBSD.org
Subject:   Re: cvs commit: src/sys/sys types.h
Message-ID:  <199905092326.JAA32555@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>>>  Make minor, major and makedev inline functions so we gain type checking
>>>  and prevent compile time creation of dev_t's from happening again.
>>
>> You can't do that.  It adds gratuitous dependencies on the compiler being
>> gcc to the most central header in the system.
>
>Well, the dependency is on a compiler that understands `inline'.  Are
>we planning to migrate to one that doesn't in the near future?  It

I use bcc in regression tests.

`inline' (actually `__inline') gets defined away unless the compiler is
gcc or supports C++, so the main effect for old compilers is to pessimise
the macros into static functions (one copy of each for every file that
includes <sys/types.h>).  The namespace change breaks working code even 
for gcc.  E.g.:

---
#include <sys/types.h>

/* %^%^@#%^ <sys/types.h> defines major(). */
#undef major

struct mymajor *major(void);
---

>also allows more type checking than a macro.

Actually, it allows less type checking than a (gcc) macro.  Args are
implicitly cast before they are used.  Even the old macros detected
some type errors.  E.g., makedev(1.2, 3.4) was an error; now it is
silently converted to makedev(1, 3).

The current implementation also requires an ANSI compiler.

Bruce


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




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