This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Deprecation of the static keyword… no more ?
I am asking this question because of a comment on an answer of mine which states that the use of static keyword on freestanding (nonmember) functions has been un-deprecated in C++0x.
Since I have no reason to doubt the above statement, I am asking this:
Can anybody please shed light on the underlying rationale of un-deprecating the use of static keyword in that context? (I mean, in C++03 the standard states that anonymous namespaces provide a superior alternative. What's changed?)
Thanks in advance
I found this in the CWG issues list:
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#174
Related
This question already has answers here:
Is the PIMPL idiom really used in practice?
(12 answers)
Closed 7 years ago.
I have occasionally come across what I can only describe as the "interface-implementation idiom", where a class is separated into an "interface class" and an "implementation class".
What is the philosophy or reasoning behind this?
What is an example usage of this methodology? What does an example of such a class system look like and why would it be useful to separate a class into an interface and an implementation?
I think what you're talking about is also known as the pImpl pattern. There is lots of discussion about it at Why Should the pImpl idiom be used. That question is also marked as a duplicate of an older question/answer with more information.
This question already has answers here:
C++ equivalent of java's instanceof
(5 answers)
Closed 9 years ago.
How can I check the class type in c++?
In Java I used instanceof.
I prefer not to use dynamic cast, but only classic c++.
Is there any way?
Clarification:
It isn't a duplicate of another question in StackOverflow, since I asked how can I find it without using of dynamic_cast. In the other question, the answer was to use it. Please don't mark it as a duplicated.
There is no way to check class type without RTTI or it's home brew substitution. If application compiled without RTTI information about type is not stored anywhere.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Does a standard implementation of a Circular List exist for C++?
Is there ready a template class in some c++ library that is some kind of a loop: A liked list where the last node references the first one.
Admittedly this wouldn't always be a practical class to use since there couldn't exist a end() iterator nor a well defined begin() iterator. But I could really have use for one and I was hoping that I wouldn't have to code it myself.
Edit:
Thank you both (Vivek Goel and madmik3) and for your answers, but unfortunately they have nothing to do with my question (I suggest http://en.wikipedia.org/wiki/Linked_list to you both). I also found the same question here, didn't find it yesterday. I apologise for posting the same question.
What about Circular Buffer from boost
http://www.boost.org/doc/libs/1_51_0/libs/circular_buffer/doc/circular_buffer.html
Boost has a circular buffer.
http://www.boost.org/doc/libs/1_51_0/libs/circular_buffer/doc/circular_buffer.html
You can also see sample code here:
http://en.wikipedia.org/wiki/Ring_buffer
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Undefined Behavior and Sequence Points
Is there any one know that whether this is valid or not in C++
int a = 0;
a = a++;
Someone told me that it will generate unknown behavior under C++ standard, did anyone know why, and where in the C++ standard states that? Thanks!
I've posted it before, and I will post it again:
http://www.slideshare.net/olvemaudal/deep-c
highly recommended for anybody with such questions in mind
The techincal reason why is that you should not modify the same variable twice (either directly or due to side effects) between sequence points.
Here is an SO question with good answers that clarifies this further and describes sequence points in general.
I don't know about the standard per se (its probably referenced from the C standard anyway), but here you can read about it:
http://www.research.att.com/~bs/bs_faq2.html#evaluation-order
This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Is there any reason to use the ‘auto’ keyword in C / C++?
can anybody explain me purpose of auto keyword in c++? thanks
It's useless and is left for old code compatibility. Long ago you used it to say that a variable is automatic, this is no longer useful - all variables witout other qualifiers are treated as automatic (stack-allocated).