Talk:Volatile (keyword)

From OSDev.wiki
Revision as of 11:23, 12 January 2009 by Combuster (talk | contribs) (Re: Volatile)

Latest comment: 15 years ago by Combuster
Jump to navigation Jump to search

Unless we are planning to document the whole of the C language this really is over the top. There is nothing special to this keyword that makes it more useful than others in OS Development... and just because you found one code listing where you think volatile was neccesary does not mean you should be setting of on a mission to teach the world about volatile. -- Tyler 16:58, 9 May 2007 (CDT)

Agreed, but I do think it has some worth. What about creating a Programming Section for articles like this? --Alboin
Reading the logs, it was more than just one code snippet. Although I think that mentioning it is a good thing, dedicating an entire page to it is over the top. Mentioning the issue on the C and C++ pages should IMO suffice.
The Linux kernel documentation devotes an entire text file to volatile. See [1]. Linus generally considers declaring data as 'volatile' to be a bad thing, particularly for shared data. IMO the arguments made in the document are sound... perhaps its worth talking about them on this page?
To be honest, I don't consider the Linux kernel maintainers to be the last instance in good programming. I also don't like blanket statements like "volatile considered harmful" (erm... then again, I based the Makefile tutorial on a paper "recursive make considered harmful", so that's a bit of a double standard there... :-D ). There are indeed some points made in the text that should be massaged into this article, but I'd also note that it refers to the Linux kernel sources, where support code for mutexes, memory I/O accessors etc. is already in place. -- Solar 07:57, 12 January 2009 (UTC)Reply[reply]
The bottom line of that document is not the blanket "don't use volatile" but it rather reads "Don't use volatile because too many of you are too stupid to apply it correctly". And it is that underlying reason that should IMO be addressed. That partly includes the examples of when and when not, but primarily about what volatile itself is about so that people can make their own educated decisions instead of randomly being told that it is bad. - Combuster 11:23, 12 January 2009 (UTC)Reply[reply]