Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Jun 1998 13:37:41 +0200
From:      Eivind Eklund <eivind@yes.no>
To:        Bruce Evans <bde@zeta.org.au>, cvs-committers@FreeBSD.ORG, phk@FreeBSD.ORG
Subject:   Re: cvs commit: src/sys/sys time.h
Message-ID:  <19980609133741.17754@follo.net>
In-Reply-To: <199806080115.LAA01973@godzilla.zeta.org.au>; from Bruce Evans on Mon, Jun 08, 1998 at 11:15:24AM %2B1000
References:  <199806080115.LAA01973@godzilla.zeta.org.au>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jun 08, 1998 at 11:15:24AM +1000, Bruce Evans wrote:
> >  Modified files:
> >    sys/sys              time.h 
> >  Log:
> >  Sigh, all good words are reserved words these days...
> >  s/private/priv/
> 
> Why not use the standard method of adding a short prefix for struct
> members?  Almost all words are reserved for use by applications.

What's safe to use as struct members is anything starting with '_' - a
program isn't allowed to declare a macro or external identifier
starting with '_'.

To avoid this infecting the kernel, it is possible to do something
like this:

#ifdef KERNEL
#define _KERNVAR(a) a
#else
#define _KERNVAR(a) _kernelname_##a
#endif

struct whatever {
	int _KERNVAR(cost);
};

which creates nice identifiers in-kernel, and avoids polluting the
user namespace.

Of course, the above gives nasty-looking headerfiles - there is always
a tradeoff...

Eivind.


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?19980609133741.17754>