Subject: Re: KNF & using _ or __ as func. name prefix
To: Chris G. Demetriou <cgd@netbsd.org>
From: Jaromir Dolecek <dolecek@ics.muni.cz>
List: current-users
Date: 11/02/1998 11:02:46
Chris G. Demetriou wrote:
> Ian Dall <Ian.Dall@dsto.defence.gov.au> writes:
> >   >> 1. _foo is used for something internal to code in question - such
> >   >> as locally used static function
> > 
> > A static function has no scope outside the file in question so you can
> > use whatever you like, but there seems no point in using a name in a
> > reserved name space.
> 
> No, you can't really use whatever name you like, if you want to be
> sure your code will work.
> 
> You might, for instance, use _foo, but if you include a standard header,
> what's to stop the implementation from defining _foo...  Sure,
> unlikely, but if you want to be sure your code'll work...

Prefixing all the functions with some prefix (such as ap_ ;) isn't very
safe as well, but is much better then _ or __ anyway ;)

The reason why I started whole discussion is I'd like to play a
bit with LKM code (kern/kern_lkm.c) and there are some functions w/o prefix
(lkmdispatch()), which seem to be called from somewhere outside;
_lkmFOO(), which are called by lkmdispatch and are static.  So I'd
like to know if there is some kind of consensus between developers
that static functions start with _ - as far as the discussion here
goes, it seems no such standard exists ;)

Jarda
> 
> 
> 
> 
> 
> cgd
> -- 
> Chris Demetriou - cgd@netbsd.org - http://www.netbsd.org/People/Pages/cgd.html
> Disclaimer: Not speaking for NetBSD, just expressing my own opinion.
> 


-- 
Jaromir Dolecek <dolecek@ics.muni.cz>	http://www.ics.muni.cz/~dolecek/
-------------------------------------------------------------------------
It is better never to have been born.  But who among us has such luck?
One in a million, perhaps.