Re: volatile. Programming Software Development by gerard4143 Volatile tells the compiler that a variable may be changed in ways not explicitly specified by the program - According to C: The complete Reference. This means the volatile variable may be changed by forces outside of the current process(usually the kernel, hardware or another process) so don't make any assumption about its current value... Re: volatile. Programming Software Development by Gonbe As far as I know Volatile is used when you don't want the compiler to … that this code will make use of, you can use volatile. Re: volatile. Programming Software Development by kvprajapati [b]>How can we use volatile variable in C or C++?[/b] [URL="http://en.wikipedia.org/wiki/Volatile_variable"]Volatile [/URL]tells the compiler not to optimize anything. volatile. Programming Software Development by rajdesire How can we use volatile variable in C or C++? Anybody can some good code to understand this. Re: volatile keyword and multiprocessors Programming Software Development by trantran …? It seems to me that the entry on "Volatile (C++)" is unambiguous. It reads: [QUOTE] Also…optimizing, the compiler must maintain ordering among references to volatile objects as well as references to other global objects…. In particular, A write to a volatile object (volatile write) has Release semantics; a reference to a… Re: volatile keyword and multiprocessors Programming Software Development by vijayan121 … to say: [QUOTE]Declaring a variable as volatile prevents the compiler from reordering references to that… variable relative to any other volatile variables. However, it does not prevent the… reordering of references to nonvolatile variables relative to the volatile variable. [/QUOTE] > the synchronisations functions (… Re: volatile keyword and multiprocessors Programming Software Development by trantran …software.intel.com/en-us/blogs/2007/11/30/volatile-almost-useless-for-multi-threaded-programming/[/url] Basically I…threading But the article appears to suggest (?) that 2) volatile is *not* required to conserve data integrity in multi…; Therefore nothing prevents a compiler to copy the non-volatile memory (let's call its location A) to *another… Re: volatile keyword Programming Software Development by mike_2000_17 …that variable or resource. At this point, the volatile keyword will have no effect (because of the increased… complexity in performing read / write operations, the volatile keyword will just tell the compiler not to do … It is stupid to declare all your variables as volatile, especially local variables (variables declared inside a function).… Re: volatile keyword and multiprocessors Programming Software Development by vijayan121 …Standard prevents compilers from reordering reads and writes to volatile data within a thread, it imposes no constraints… above. If your multithreaded code works properly with volatile and doesn’t work without, then either your C…++ implementation carefully implemented volatile to work with threads (less likely), or you … Re: volatile keyword and multiprocessors Programming Software Development by vijayan121 … 2005 > any global or static object (non-volatile or volatile) will be flushed before a write on any…- in Microsoft C++ [B]volatile[/B] enforces acquire and release ordering for all volatile variables as well as all non…-volatile variables with a static storage duration.… Re: volatile keyword and multiprocessors Programming Software Development by trantran …debated is not general synchronisation but the specific case of volatile keyword and microprocessor in the specific example given: - …://software.intel.com/en-us/blogs/2007/11/30/volatile-almost-useless-for-multi-threaded-programming/[/url] which is… believe an ACM paper of 2008: `"The “volatile errors” column in Table 1 shows that no compiler … volatile keyword and multiprocessors Programming Software Development by trantran …multiprocessors and mutlithreading. What I understand is that the volatile keyword can be quite expensive because the data won'… there would (theoretically!) be no need to use volatile since at any moment of the program the memory …sleep branch 1 would "flush" its non-volatile memory to guarantee that its processor register and cache … Re: volatile keyword and multiprocessors Programming Software Development by jmichae3 … different threads writing simultaneously to the same chunk of shared volatile memory or even in sequence this can cause problems with… are children. 2 ideas are WaitForMultipleObjects or using a global volatile shared array or vector of variables (1 element for each… Volatile keyword atomicity Programming Software Development by saurabh.mehta.33234 … in Multi Threading and I came across this statement: *Volatile is preferred in cases when one thread reads and writes … read and write both on the shared variable then only volatile is not enough, you need to have synchronisation as well… Re: "volatile string" why has 1 output? Programming Software Development by Narue … is interpreting the object as a bool due to the volatile qualifier. It's a quirk of overloading for the &…lt;< operator. Long answer: A volatile pointer can't be converted to a non-volatile pointer without an explicit cast, so…when the << operator is called. There's no volatile qualified overload, and the closest match is the bool overload… Re: volatile keyword and multiprocessors Programming Software Development by trantran There seem to be a bug in the editor window of the blog. The link below does not show correctly: I will try to use a comment to paste it correctly [CODE] /* http://software.intel.com/en-us/blogs/2007/11/30/volatile-almost-useless-for-multi-threaded-programming/*/[/CODE] Re: volatile keyword and multiprocessors Programming Software Development by trantran The other also didn`t paste correctly here are all links inside comments: [CODE] /* http://msdn.microsoft.com/en-us/library/windows/desktop/ms686355%28v=VS.85%29.aspx http://www.cs.utah.edu/~regehr/papers/emsoft08-preprint.pdf http://software.intel.com/en-us/blogs/2007/11/30/volatile-almost-useless-for-multi-threaded-programming/ */ [/CODE] Re: volatile keyword and multiprocessors Programming Software Development by trantran … want, actually very easily, simply because: a) the keyword "volatile" meaning has been changed to a proprietary-sort of… Re: volatile collection Programming Software Development by icgc ….com/questions/72275/when-should-the-volatile-keyword-be-used-in-c]When should the volatile keyword be used in C#?[/url… Antenka Thanks for your reply. It looks like using the volatile keywork will not be suitable for what I am trying… Re: Volatile keyword atomicity Programming Software Development by JamesCherrill One thread can both read and write a volatile variable, all the other threads can only read it. You say you are aware of the concept, so what exactly is confusing you, and what exactly do you want an example to show? Re: volatile collection Programming Software Development by Antenka I think this discussion can put some light on your problem: [url=http://stackoverflow.com/questions/72275/when-should-the-volatile-keyword-be-used-in-c]When should the volatile keyword be used in C#?[/url] volatile variable Programming Software Development by kararu Hi all, Is there anything in perl to declare a variable volatile...I need the value of a variable to change immeadiately when I change.help out pls. Re: volatile variable Programming Software Development by kararu Actually a variable will stay in register for a while and then be put in memory..I need the memory location to change immediately when I change the variable.(Like volatile variable in C) Volatile Number of Objects Programming Software Development by CoolGamer48 Hey, Is there anyway to control a volatile number of objects (don't know if I'm using … volatile collection Programming Software Development by icgc … objects within the collection 2) I mark the collection as volatile Thanks "volatile string" why has 1 output? Programming Software Development by rhoit [CODE] #include <iostream> int main() { for(int i; i<3; i++){ volatile char str[]="hello\n"; std::cout<<str<<std::endl; } return 0; } [/CODE] Why? its gives output [ICODE] 1 1 1 [/ICODE] volatile keyword Programming Software Development by murnesty I know the purpose of keyword but then I still not really know when should i use. But I sure I will optimize my code. So is it ok to i use volatile keyword on all my variables? So that it won't optimize the wrong thing. Re: Const volatile Programming Software Development by jephthah … means the program can not modify the value [iCODE]volatile [/iCODE]means the value may be arbitrarily modified outside …prevents the value from being stomped on, while [iCODE]volatile [/iCODE]tells the compiler that this value can be … any time external to the program. this [iCODE]const volatile <type> <variablename>[/iCODE] will … regarding usage of const static var, const volatile var, Programming Software Development by rakeshbk402 hello. I need to know what is & where actually the usage of const static variable, const volatile variable, static volatile variable is used. thanks, with regards Rakesh. Re: Const volatile Programming Software Development by Saikrishna_bhi …entity like a peripheral device. Declaring a variable as volatile indicates the compiler that the variable might be changed … cpu cycles). Now Declaring a variable as a const volatile, we indicate the compiler that variable cant be modified… by an external entity. The usage of const volatile is more predominant in Device Driver Programming.