Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Oct 1997 23:16:24 +0000 (GMT)
From:      Terry Lambert <tlambert@primenet.com>
To:        mike@smith.net.au (Mike Smith)
Cc:        mdean@best.com, julian@whistle.com, freebsd-hackers@FreeBSD.ORG
Subject:   Re: devfs / cdevsw
Message-ID:  <199710052316.QAA22821@usr05.primenet.com>
In-Reply-To: <199710040801.RAA00530@word.smith.net.au> from "Mike Smith" at Oct 4, 97 05:31:19 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> > What does __P() do to a function declaration? I see it in the lkm examples.
> > And also in .h files for c library calls apparently (pointing?) to the
> > kernel syscalls.
> 
> It's archaic junk left over from the days of pre-ANSI compilers.  Use 
> it if you are adding to an existing source file (ie. maintain 
> consistency), but do not use it in new code.

Unless you want the code to be portable to archaic pre-ANSI compilers,
either becuase you own an older system, or you want someone who owns
an older system to someday be able to use your code.

It's a result of the gratuitous addition of prototypes to function
declarations, really.  A object file format that contained argument
attribution for function arguments (unlike C++ symbol munging) would
have spared us the need to declare the functions as prototypes, and
would still have caught prototype forward declaration vs. function
declaration mismatches at link time, as well as catching usage without
a forward declaration prototype in scope.

Ideally, you would delay actual code generation to link time, and
save quads (or similar intermediate compilatation data) in the
object files.  This would, at the same time, have solved the "near/far"
problem, since the memory reference could have been resolved to a near
or far call at code generation time.

Basically, compiler writers are lazy, even though compiler users
outnumber them 1000 or more to 1.


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.



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