|
-
January 6th, 2010, 09:30 PM
#3
Re: Assigning value to a volatile string
In general, the synthesized assignment operators cannot be used on a volatile object.
why? because you're saying to the compiler that the object is subject to the changes in value,
while the assignment operator takes a const parameter.
Based on what I've read these were my thoughts too. I'm doing this because I have some program where I need to read in a string from cin, or something similar, in one thread, and access it from various other threads. I can seem to get it to compile fine with volatile const char*; I'm just curious as to why I'm having such issues with std::string.
On a side note, I find "volatile const char*" to seem somewhat contradictory, but it compiles.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|