Subject: Re: Are gcc syntax extensions ok to use?
To: Rafal Boni <rafal@mediaone.net>
From: John Fremlin <chief@bandits.org>
List: tech-kern
Date: 04/22/2001 07:39:28
Rafal Boni <rafal@mediaone.net> writes:
> -> Specifically, named struct field initializers, for example,
> ->
> -> static struct wsscreen_descr wssd_stdscreen = {
> -> name: "LCD",
[...]
> IMNSHO, the structure definition should serve as adequate
> documentation for the fields in the structure, even if it's located
> in a header file somewhat removed from the declaration.
It's not just documentation, it's like named parameter passing in
e.g. Ada. The point is that you don't have to remember the exact order
of fields in a struct and lets people reorder them for cache whatnot
behaviour.
Of course if NetBSD does not explicitly depend on gcc, the syntax have
to go, which is a shame, because I think it looks quite pretty :-)
If gcc is not official, how do you do stuff like this specific
example, taken out of my code for the Psion 5 MX port:
u_int32_t
inline static mmu710T_get_ctrl(void)
{
u_int32_t c1;
__asm __volatile("mrc p15, 0, %0, c1, c0"
:"=r"(c1))
;
return c1;
}
making use of the cool gcc asm syntax?
(The alternative, it seems to me, is to study ABI documents to decide
which registers may be clobbered which is not my idea of fun and
creates unmaintainable assumptions).
[...]
--
http://www.penguinpowered.com/~vii