Re: [PATCH] "volatile considered harmful", take 3



On 5/12/07, H. Peter Anvin <hpa@xxxxxxxxx> wrote:
Satyam Sharma wrote:
>
> Because volatile is ill-defined? Or actually, *undefined* (well,
> implementation-defined is as good as that)? It's *so* _vague_,
> one doesn't _feel_ like using it at all!
>

Sorry, that's just utter crap. Linux isn't written in some mythical C
which only exists in standard document, it is written in a particular
subset of GNU C. "volatile" is well enough defined in that context, it
is just frequently misused.

Of course, volatile _is_ defined (well, _anything_ that is implemented
_is_ defined, after all) in the context of GNU C, and if you're saying
that the kernel (and all its subsystems) is and should _continue_ to
be (the purpose of this document) written within that context, then
that's your opinion and I would not disagree with you. If you do
prefer to continue using that dialect, then I wouldn't stop you either.

Personally, I'd prefer writing in a slightly more portable / larger
context (using well-defined and understood APIs), thank you, and
hope you'd allow me to do so myself.

Coming back to the document, we do need to document / find
consensus on the "preferred" way to do similar business in the
kernel, and my opinion as far as that is concerned is to shun
volatile wherever possible (which includes the case originally
discussed above).

Satyam
-
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/



Relevant Pages

  • Re: [PATCH] "volatile considered harmful", take 3
    ... Linux isn't written in some mythical C ... > _is_ defined, after all) in the context of GNU C, and if you're saying ... This isn't just an opinion, this is the language the Linux kernel is ...
    (Linux-Kernel)
  • Re: Note function
    ... you're using it in a context where the exceptions won't make a difference, ... is that definition often has a great deal to do with context. ... he gave this as an answer to my saying ... so frustrated with the constant opinion, no fact, opinion, no fact, ...
    (rec.music.theory)
  • Re: [patch 00/11] ANNOUNCE: "Syslets", generic asynchronous system call support
    ... properly separating the user execution context from the kernel execution ... What about TLS related kernel ...
    (Linux-Kernel)
  • Re: Weapons that look like toys
    ... We were speaking of within the context of public opinion. ... from any Israeli action, ... I've neither endorsed nor refused to endorse such a position. ...
    (rec.martial-arts)
  • Re: linux context switching
    ... the process is excuted in a kernel mode, at this momnet is there context ... all registers are saved on the stack. ... interrupt handler is excuted ...
    (comp.os.linux.development.system)