Re: [PATCH] doc: volatile considered evil

From: Alan Cox
Date: Wed May 09 2007 - 16:19:34 EST


On Wed, 9 May 2007 11:41:27 -0700 (PDT)
David Rientjes <rientjes@xxxxxxxxxx> wrote:

> On Wed, 9 May 2007, Alan Cox wrote:
>
> > > Thus, any reliance on type-qualifying an object that represents an atomic
> > > or locking primitive on the keyword 'volatile' is misplaced.
> >
> > arch/foo is generally implementation specific code.
> >
>
> That's true, but what qualifies as an "access" to an object that is
> type qualified with the 'volatile' keyword is _implementation_ defined,
> meaning the behavior is defined by the compiler and not this new
> architecture you're proposing 'volatile' is appropriate for. That's pure
> C99.

arch/foo almost always supports a single compiler too - gcc. We simply
don't support anything else. We use gcc inlines and features extensively.

And who cares about such fine detail of C99, did they fix the struct copy
bug in ANSI C even ? [1]

Alan
[1] ANSI C says access to the padding fields of a struct is undefined.
ANSI C also says that struct assignment is a memcpy. Therefore struct
assignment in ANSI C is a violation of ANSI C...

At this point its a lot simpler not to care about other compilers pet
insanities or areas of the spec like volatile that are vaguer and less
credible than the output of the US congress.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/