Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

First of all, this is not a formal C++ question.

I have been working with C++ for many years. Most of time, I improve my skill by working on different projects, reading good books, and learning from teammates. My posted questions are frequently answered by some experts here with quotes from the C++ Standard.

I am really amazed how people can know the C++ Standard so well that they can immediately find the corresponding guidelines.

Here is the question for those C++ experts:

Do you guys really read the C++ Standard page by page or you are the persons who had reviewed the standard in the past?

share|improve this question

migrated from stackoverflow.com May 17 '11 at 20:24

This question came from our site for professional and enthusiast programmers.

14  
that's a million dollar question.. –  ascanio May 17 '11 at 19:57
14  
I just search the PDF. –  Neil Butterworth May 17 '11 at 20:01
1  
something called "reading for comprehension", and lots of it. –  Jarrod Roberson May 17 '11 at 20:52
1  
I have met a few programmers who could tell between undefined behaviour and unspecified behaviour on their feet. But what they knew that well was fairly limited to how many programs they have written and how many problems they have solved. Writing programs alone does not seem to cut it to become an expert as you describe. –  vpit3833 May 17 '11 at 23:59
1  
The C++ committee has always had two working groups, Core and Library. At times I joke that's because nobody is capable of understanding the whole thing. :P And at other times, I'm dead serious when I say that. –  MSalters May 23 '11 at 15:13
show 1 more comment

7 Answers

Well, first and foremost, asking / reading a lot of questions on SO helps. :) You just will remember some stuff from the standard after some time.

Then, reading the standard and searching for points hinted at answers here on SO. It also helps to get the latest draft on the official site (relevant latest C++0x draft). Also, here is a link for purchasing the current C++03 standard. Also, this article by Herb Sutter might be of interest.

Next, working with the language on a daily basis is pretty much a basic on this, in addition to really likeing the language.

Other than that, experience. :)

share|improve this answer
1  
@Xeo, I don't know what kind of companies people here work with. For me, I am working in a big software company and you don't learn too much skill by just doing the assigned jobs. The daily tasks most time just involves to use the known skill again and again. To me, it is really important to keep learning from Experts here and hopefully some time in the future, I can be one of them. –  q0987 May 17 '11 at 20:19
    
`+1 ++ [&] >> _1, (void)(T<X>) const throw() { / padding */ } –  sehe May 17 '11 at 20:21
add comment

I wouldn't pretend to be an expert on the contents of the C++ standard but I keep my copy by my bed in case I have trouble sleeping. Evidently, I have a lot of trouble sleeping.

The standard is the definitive place to go for answers about the language. The more you look things up to get the definitive answer on something, the more knowledge you acquire.

share|improve this answer
1  
@Charles, to me the C++ standard is written in a way that is not easy to understand. Similar as the law document, nothing more and nothing less. So I have to train myself to learn how to read the standard. -- thx –  q0987 May 17 '11 at 20:11
2  
@q0987: Yes, standardese isn't designed to be an easy read, it's supposed to be enable a definitive unambiguous interpretation (in some cases it even succeeds!) so that it can be used as the basis of a contract between implementers and users of the language. This is why it is terse and uses defined terms for their exact meaning rather than adopting the more accessible but less precise language you might find in a text book. –  Charles Bailey May 17 '11 at 20:21
2  
@Charles: For small values of "in some cases". ;) –  Xeo May 17 '11 at 20:53
1  
@Xeo: Actually, I think for quite large values. Nobody ever thinks about, let alone remarks on, the places where it gets it right. It's the less good parts that generate all the discussions. –  Charles Bailey May 17 '11 at 21:09
    
@Xeo, the standard is unambiguous on the most part. In many places is direcly unambiguous, in others it requires going back and forth to read and process the exact definitions, in some places there are ambiguities, but overall it is the best technical document I have read. –  David Rodríguez - dribeas May 17 '11 at 21:58
show 1 more comment

I'll reiterate my comment. Search the PDF. Unfortunately, you have to pay for the final standards document.

share|improve this answer
    
BTW, can you tell us where to buy a copy of the standard? –  Kiril Kirov May 17 '11 at 20:12
    
@Kiril: the ISO homepage might be a good starting point. :) –  Xeo May 17 '11 at 20:19
    
@Xeo - I saw this, but it says "CHF 380,00" which is about 300 euro! This can't be true :D –  Kiril Kirov May 17 '11 at 20:22
3  
@Xeo, @Kiril: The name of the current standard document is "ISO/IEC 14882:2003(E)". Google it, you might find it even cheaper. –  Steve Jessop May 17 '11 at 20:49
10  
Ugh, having to buy the specification of a language sounds so wrong to me. –  nightcracker May 17 '11 at 23:03
show 9 more comments

For some it's just decades of experience and a decent memory. Working with the language on a daily basis helps.

I can't do much more with this open-ended question.

share|improve this answer
    
So, this isn't the case for you? –  Neil Butterworth May 17 '11 at 20:07
    
@Neil: It is. That's why my answer is about it. –  Lightness Races in Orbit May 17 '11 at 20:09
    
@Tomalak: Are you an expert? :P (recall that the question is for the experts :D). –  Nawaz May 17 '11 at 20:11
1  
@Nawaz: Sad face :( –  Lightness Races in Orbit May 17 '11 at 20:12
add comment

I certainly don't have the standard memorized.

For me it's a combination of experience, being bitten by various bugs, learning sections of the standard when I have questions, and a good search function (knowing common terms to search for is helpful). It's hard to be more precise than that.

share|improve this answer
    
Well. Mark B too is an expert :P –  Nawaz May 17 '11 at 20:12
add comment

I went through a period of about 18 months where I actually read the Standard, cover-to-cover. I did this because I wanted to accomplish two things. One, I wanted to make sure I understood the difference between what worked on my compiler at that time (VC6) and what was actually "legal". Two, I wanted to illuminate some dark corners of C++ that I didn't know existed. Overall, I wanted a complete technical understanding of the language.

Some sections were more interesting than others. Some were very, very difficult to get anything from. If I were being generous, I'd say I retained about 10-15% of all the new knowledge I gained.

I learned that a lot of the thing I was doing was not actually legal. For example:

for( int i = 0; i < 10; ++i )
{
  // magic
}
cout << i;

...and better ways to do things I was doing in a clumsy or inefficient way, for example:

MyGizmo gizmo;
memset(&gizmo, 0, sizeof(gizmo));

...might be improved by:

MyGizmo gizmo = {};

I'm currently working my way through the latest draft of the new Standard. There is a lot about C++0x that I don't know.

I may have retained very little from reading the standard, but one thing I did retain was the ability to actually read it. Now when I have a question about the language, the Standard is the first place I go, and I can usually find an answer in relatively short order.

Do I recommend this approach for others? No. Not unless you are a minutiae glutton.

share|improve this answer
add comment

To answer certain kinds of questions about the language and its use, you have to read the spec, that's all. There's nothing cabalistic or even mysterious about it. Even though the spec is badly worded and ambiguous in spots, it is the highest authority on the syntax and semantics of C++.

If you write code that violates the spec -- your code gives undefined behavior, for example -- and then come to SO asking a question about that code, you might find yourself the target of a whole bunch of spec citations, quotations, excerpts, and examples.

Every C++ programmer would do well to at least know where the spec is. But [ahem!] I don't know. Why not google for the spec and take a look? Then post where you found it. Thanks!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.