Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to understand the C++ specification?

1 view
Skip to first unread message

doublem...@gmail.com

unread,
Jan 25, 2009, 9:00:32 AM1/25/09
to
Is there any way i can understand C++ specifications? Every time i
read..i find it diff to understand..so i read more books on C++ and
come back..still the result is same..Are there any links, refereces
or documents which helps to parse specification easily?? I really
wanna understand that..pls help me..

Victor Bazarov

unread,
Jan 25, 2009, 10:47:16 AM1/25/09
to

There are plenty of sources of information on C++. Some are easier
to understand, some are more difficult. It is impossible to know
which ones *you* will find easy without knowing *you* personally.
What exactly do you find difficult? BTW, which "specification" do
you mean? The Standard? It's a rather dry text, and is not really
designed to be the source of information for the general public on
how C++ works. Try www.accu.org; their book review section has
quite a few books on C++ reviewed, you can see which ones are for
you, perhaps. Another good way is to go to the good bookstore and
leaf through several books trying to see if you can understand it
if you open it in the middle...

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask


Nosophorus

unread,
Jan 25, 2009, 2:42:14 PM1/25/09
to
Hi!

The first C++ book I read was "Rescued By C++". I thought it a fairly
nice introductory C++ book. It is not as "profound" as "Thinking In C+
+" (which you can get for free from web). BUT, as a first contact with
the language, it is nice.

I recommend "Rescued By C++" as an introduction and, then, "Thinking
In C++" as the next step. After those two books, maybe, the reader is
well suited to wonder through Stroustrup's "The C++ Programming
Language".

Marcelo de Brito

doublem...@gmail.com

unread,
Jan 26, 2009, 6:07:26 AM1/26/09
to

Hmm..Actually i am confiratable with C++ and have 2 years of
experience in C++. I have read some other advanced books like
Effective C++ , more effective C++ , etc..I feel that C++ standard i
should be reading because it decides sytanx and semantix of the C++.
But it uses tough notations, definations that i am finding little diff
to understand!

stev...@gmail.com

unread,
Jan 26, 2009, 6:31:56 AM1/26/09
to
On Jan 26, 6:07 am, "doublemaster...@gmail.com"

Your experience is fine but post a specific example of something you
can't understand. I have less experience but am finding the standard
reasonable so please post something specific.

Christian Hackl

unread,
Jan 26, 2009, 7:31:21 AM1/26/09
to
doublem...@gmail.com ha scritto:

>
> Hmm..Actually i am confiratable with C++ and have 2 years of
> experience in C++.

Do you mean "comfortable", or is "confiratable" really an English word?
If so, I cannot find it in the dictionary :)

Two years of experience is not very much at all for a language as
complex as C++. It's a good start, but you need even more experience.

> I have read some other advanced books like Effective C++ , more
> effective C++ , etc..I feel that C++ standard i should be reading
> because it decides sytanx and semantix of the C++. But it uses tough
> notations, definations that i am finding little diff to understand!

The main audience of the standard, as far as I know, are compiler
writers, not everyday users. You are better off with textbooks.


--
Christian Hackl
ha...@sbox.tugraz.at

Noah Roberts

unread,
Jan 26, 2009, 12:15:17 PM1/26/09
to

I disagree with the assessment of others here, that you don't need to
read the standard. The standard should be on everyone's desk. It is
the only way to know what's going on with your code in many situations.
What's funny is that most the people who say you don't need it also
refer to it regularly to answer questions asked in this newsgroup.

As with all things, reading the standard takes practice. Just keep
trying. Make sure to read the first section where all the definitions
are defined in rigor.

Bo Persson

unread,
Jan 26, 2009, 12:41:03 PM1/26/09
to
Noah Roberts wrote:
> doublem...@gmail.com wrote:
>> Is there any way i can understand C++ specifications? Every time i
>> read..i find it diff to understand..so i read more books on C++
>> and come back..still the result is same..Are there any links,
>> refereces or documents which helps to parse specification
>> easily?? I really wanna understand that..pls help me..
>
> I disagree with the assessment of others here, that you don't need
> to read the standard. The standard should be on everyone's desk. It
> is the only way to know what's going on with your code in many
> situations. What's funny is that most the people who say you don't
> need it also refer to it regularly to answer questions asked in
> this newsgroup.

I believe some of those people also have 20 years of experience, and a
ton of other books in their bookshelf. None of them started out with a
standard document.

The thing is that you cannot learn to program from the standard, so
you shouldn't start there. Read a couple of other books first, and get
some practical experience.


>
> As with all things, reading the standard takes practice. Just keep
> trying. Make sure to read the first section where all the
> definitions are defined in rigor.

And don't forget to read another book or three first!


Bo Persson


Ian Collins

unread,
Jan 26, 2009, 4:12:01 PM1/26/09
to

The standard is a reference document, treat it as your would any other
reference. It isn't light reading!

It's clear that you aren't a native English speaker and this will make
the precise and terse language of the standard hard going.

Stick with the books and check the standard when you need clarification.

--
Ian Collins

James Kanze

unread,
Jan 27, 2009, 4:01:51 AM1/27/09
to
On Jan 26, 12:07 pm, "doublemaster...@gmail.com"

<doublemaster...@gmail.com> wrote:
> On Jan 26, 12:42 am, Nosophorus <Nosopho...@gmail.com> wrote:

> > The first C++ book I read was "Rescued By C++". I thought it
> > a fairly nice introductory C++ book. It is not as "profound"

> > as "Thinking In C++" (which you can get for free from web).


> > BUT, as a first contact with the language, it is nice.

> > I recommend "Rescued By C++" as an introduction and, then,
> > "Thinking In C++" as the next step. After those two books,
> > maybe, the reader is well suited to wonder through
> > Stroustrup's "The C++ Programming Language".

> Hmm..Actually i am confiratable with C++ and have 2 years of


> experience in C++. I have read some other advanced books like
> Effective C++ , more effective C++ , etc..I feel that C++
> standard i should be reading because it decides sytanx and
> semantix of the C++. But it uses tough notations, definations
> that i am finding little diff to understand!

The standard is written in a variant of English sometimes called
standardese. It's designed (or at least intended) to be
absolutely precise and unambiguous, even at the cost of
understandability. It doesn't always succeed with its intent,
but in all cases, precision and a lack of ambiguity have
precedence over readability.

Having said that: the major problem with readability I have is
finding what I'm looking for. Who'd think to look for "lifetime
of temporaries" in the section on "special member functions"?
And the definition of a POD struct refers to the definition of
an aggregate, which is in the section on initializers. Once
I've found it, however... The quality of the prose varies, but I
find most of it pretty readable... and not always as precise and
unambiguous as I'd like.

--
James Kanze (GABI Software) email:james...@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

James Kanze

unread,
Jan 27, 2009, 4:05:42 AM1/27/09
to
On Jan 26, 6:15 pm, Noah Roberts <n...@nowhere.com> wrote:

> doublemaster...@gmail.com wrote:
> > Is there any way i can understand C++ specifications? Every
> > time i read..i find it diff to understand..so i read more
> > books on C++ and come back..still the result is same..Are
> > there any links, refereces or documents which helps to
> > parse specification easily?? I really wanna understand
> > that..pls help me..

> I disagree with the assessment of others here, that you don't
> need to read the standard. The standard should be on
> everyone's desk. It is the only way to know what's going on
> with your code in many situations.

If that's true, then the code you're writing is too complicated,
and makes too much use of limit conditions. About the only time
I'll refer to the standard when writing code is for library
functions, and that's just because I don't have any other
documentation on line.

> What's funny is that most the people who say you don't need it
> also refer to it regularly to answer questions asked in this
> newsgroup.

That's because a lot of questions here concern things you
shouldn't be doing in production code anyway:-).

Pete Becker

unread,
Jan 27, 2009, 7:02:45 AM1/27/09
to
On 2009-01-27 04:01:51 -0500, James Kanze <james...@gmail.com> said:

>
> Having said that: the major problem with readability I have is
> finding what I'm looking for. Who'd think to look for "lifetime
> of temporaries" in the section on "special member functions"?

Someone who looked in the index? All but one of the entries under
"temporary" point to the two pages in the subsection entitled
"Temporary objects". Granted, there's no "lifetime of" subentry, but
it's not hard to find.

--
Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The
Standard C++ Library Extensions: a Tutorial and Reference
(www.petebecker.com/tr1book)

Noah Roberts

unread,
Jan 27, 2009, 12:43:20 PM1/27/09
to
James Kanze wrote:
> On Jan 26, 6:15 pm, Noah Roberts <n...@nowhere.com> wrote:
>> doublemaster...@gmail.com wrote:
>>> Is there any way i can understand C++ specifications? Every
>>> time i read..i find it diff to understand..so i read more
>>> books on C++ and come back..still the result is same..Are
>>> there any links, refereces or documents which helps to
>>> parse specification easily?? I really wanna understand
>>> that..pls help me..
>
>> I disagree with the assessment of others here, that you don't
>> need to read the standard. The standard should be on
>> everyone's desk. It is the only way to know what's going on
>> with your code in many situations.
>
> If that's true, then the code you're writing is too complicated,
> and makes too much use of limit conditions. About the only time
> I'll refer to the standard when writing code is for library
> functions, and that's just because I don't have any other
> documentation on line.

Yes, we've already established that "Hello World!" is about as involved
as your software gets. Some of us though have to work a little harder
for our living and are not afraid of using the language to its full
potential in order to get that job done.

Frankly, if I'd never needed the standard to answer a question about a
problem I'd run into...I'd certainly never admit it. It could only mean
one of two things: 1) I'm an intermediate programmer at best who's never
run into the least complication in one of the most complex languages out
there or 2) I think I already know everything and just hack at things
until they work. Which are you?

James Kanze

unread,
Jan 28, 2009, 5:23:15 AM1/28/09
to
On Jan 27, 6:43 pm, Noah Roberts <n...@nowhere.com> wrote:
> James Kanze wrote:
> > On Jan 26, 6:15 pm, Noah Roberts <n...@nowhere.com> wrote:
> >> doublemaster...@gmail.com wrote:
> >>> Is there any way i can understand C++ specifications?
> >>> Every time i read..i find it diff to understand..so i
> >>> read more books on C++ and come back..still the result is
> >>> same..Are there any links, refereces or documents which
> >>> helps to parse specification easily?? I really wanna
> >>> understand that..pls help me..

> >> I disagree with the assessment of others here, that you
> >> don't need to read the standard. The standard should be on
> >> everyone's desk. It is the only way to know what's going
> >> on with your code in many situations.

> > If that's true, then the code you're writing is too
> > complicated, and makes too much use of limit conditions.
> > About the only time I'll refer to the standard when writing
> > code is for library functions, and that's just because I
> > don't have any other documentation on line.

> Yes, we've already established that "Hello World!" is about as
> involved as your software gets. Some of us though have to
> work a little harder for our living and are not afraid of
> using the language to its full potential in order to get that
> job done.

Getting the job done, in my case, means writing code that works,
and that can be maintained. I know that that's an unusual
requirement. It's much more fun to experiment.

> Frankly, if I'd never needed the standard to answer a question
> about a problem I'd run into...I'd certainly never admit it.

So you have to maintain poorly written code. It happens. I've
also had to check the standard once or twice to know exactly
what some poorly written code meant. (I'm not sure that the
author realized himself what it really meant.)

> It could only mean one of two things: 1) I'm an intermediate
> programmer at best who's never run into the least complication
> in one of the most complex languages out there or 2) I think I
> already know everything and just hack at things until they
> work. Which are you?

What it means is that I don't use constructs I (or my collegues)
can't understand, and that we don't know what they do. It's
called writing working, maintainable code. If you need to check
the standard for code you're writing, then it's probably a
concept you're not familiar with.

Noah Roberts

unread,
Jan 28, 2009, 12:17:19 PM1/28/09
to
James Kanze wrote:
> What it means is that I don't use constructs I (or my collegues)
> can't understand, and that we don't know what they do.

...and of course you know exactly what everything in C++ does without
looking at the standard...ever.

Well, James, looks like I'm just not as smart as you are. In order to
know what things do in C++ I have to read how the various combinations
of constructs work within C++. Only then can I write maintainable code
I understand. Looks like you just started out knowing everything so in
that regard I would have to say you're a very lucky man; I had to work
for my knowledge.

Noah Roberts

unread,
Jan 28, 2009, 12:24:05 PM1/28/09
to
Oh, and...

James Kanze wrote:

> Getting the job done, in my case, means writing code that works,
> and that can be maintained. I know that that's an unusual
> requirement. It's much more fun to experiment.

I think you just proved my point. If you've never HAD to experiment
then you've simply never written anything particularly difficult. I
suppose you spent your entire learning period not experimenting too.
That's just sad.

Yes, I'm proud to admit that much of my knowledge comes from
experimenting, failing, and having to look at the standard to see why
what I'm doing is nonsense. My knowledge came from years of hard work
and many, many mistakes. Where did yours come from?

James Kanze

unread,
Jan 29, 2009, 3:30:06 AM1/29/09
to
On Jan 28, 6:17 pm, Noah Roberts <n...@nowhere.com> wrote:
> James Kanze wrote:
> > What it means is that I don't use constructs I (or my collegues)
> > can't understand, and that we don't know what they do.

> ...and of course you know exactly what everything in C++ does without
> looking at the standard...ever.

> Well, James, looks like I'm just not as smart as you are. In
> order to know what things do in C++ I have to read how the
> various combinations of constructs work within C++. Only then
> can I write maintainable code I understand.

If you have to look things up in the standard, then you're not
writing code you (or someone else) can maintain. You're working
too near the limits (and the code wouldn't pass code review in
any place I've worked).

James Kanze

unread,
Jan 29, 2009, 3:37:48 AM1/29/09
to
On Jan 28, 6:24 pm, Noah Roberts <n...@nowhere.com> wrote:
> Oh, and...

> James Kanze wrote:
> > Getting the job done, in my case, means writing code that
> > works, and that can be maintained. I know that that's an
> > unusual requirement. It's much more fun to experiment.

> I think you just proved my point. If you've never HAD to experiment
> then you've simply never written anything particularly difficult. I
> suppose you spent your entire learning period not experimenting too.
> That's just sad.

Isn't it beautiful, people who like to play word games, instead
of worrying about real issues.

Obviously, I experiment. But I don't deliver experimental code.
And I don't need to look things up in the standard to
experiment, since I know that if I do, even if the experiment
works, I can't use it, because 1) my collegues won't understand
the code, and 2) it's likely that some compiler will not get it
right either (and in the end, what matters isn't what the
standard says, but what the compiler does). I don't experiment
with the language much (except for amusement); I have enough
other problems which have to be solved. (As one employer put
it: I'm not being paid to stress test the compiler. *IF* you're
employed to test a compiler for compliance, then of course you
will read the standard. A lot. But that's not the case of most
of us.)

> Yes, I'm proud to admit that much of my knowledge comes from
> experimenting, failing, and having to look at the standard to
> see why what I'm doing is nonsense.

I fail to see how you can find out whether something is nonsense
by looking it up in the standard. (For that matter, the
standard is often "wrong", compared to the compilers I'm using.)

> My knowledge came from years of hard work and many, many
> mistakes. Where did yours come from?

Most of it comes from communicating with collegues. I've
learned an awful lot from other peoples mistakes. And vice
versa, of course. My collegues learn from my code. Which is
one of the reasons why it's so important to make it readable.

Noah Roberts

unread,
Jan 29, 2009, 1:20:25 PM1/29/09
to
James Kanze wrote:
> On Jan 28, 6:17 pm, Noah Roberts <n...@nowhere.com> wrote:
>> James Kanze wrote:
>>> What it means is that I don't use constructs I (or my collegues)
>>> can't understand, and that we don't know what they do.
>
>> ...and of course you know exactly what everything in C++ does without
>> looking at the standard...ever.
>
>> Well, James, looks like I'm just not as smart as you are. In
>> order to know what things do in C++ I have to read how the
>> various combinations of constructs work within C++. Only then
>> can I write maintainable code I understand.
>
> If you have to look things up in the standard, then you're not
> writing code you (or someone else) can maintain.

Well, if you say so it must be true. Guess I'll just have to live with
my unmaintainable code, unmaintainable code that's as sure to be
standard compliant as I can make it.

Noah Roberts

unread,
Jan 29, 2009, 1:56:53 PM1/29/09
to
James Kanze wrote:

>> Yes, I'm proud to admit that much of my knowledge comes from
>> experimenting, failing, and having to look at the standard to
>> see why what I'm doing is nonsense.
>
> I fail to see how you can find out whether something is nonsense
> by looking it up in the standard. (For that matter, the
> standard is often "wrong", compared to the compilers I'm using.)

Case in point. Yesterday one of the developers ran into a problem with
a virtual function not being called. He was subclassing an object
residing in a library we are using. Had I not a decent grasp of the
language, by reading the standard, I would not have been able to tell
him exactly why it's broken and send the bug information to the library
developer allowing them to fix it that day. Granted, it was a rookie
mistake but knowing these things allowed me to say with absolute clarity
that it was this that caused it and not something else.


>
>> My knowledge came from years of hard work and many, many
>> mistakes. Where did yours come from?
>
> Most of it comes from communicating with collegues. I've
> learned an awful lot from other peoples mistakes. And vice
> versa, of course. My collegues learn from my code. Which is
> one of the reasons why it's so important to make it readable.

Great, you learn from each other. Like I don't. I suppose none of you
step OUTSIDE your little circle either?

You like to call the areas where the standard is important "too near the
limits". Well, I've found it incredibly easy then to reach the "limits"
(as you call them) of C++. Why did my code work on one compiler and not
the other? Why, look in the standard and find I'm doing something
slightly wrong...or...the compiler I used originally was broken and now
the new one is fixed and my code must change...or, the compiler I'm
using is NOT compliant and I need to make a special case for it. These
cases are simple (template friendship, templates in general,
availability of member addresses) and often run into.

I suppose if you live in some happy, nonexistant la-la land where all
compilers are compliant then you don't have to worry about these things.
Tell me, how do YOU know which compiler is compliant without looking
at the standard?

Furthermore, the standard is the absolutely best reference for the
library that exists. The Josuttis book is a great tutorial but the std
is a much better reference. Standards compliance issues in production
code are also quite often involving misuse and misunderstanding of the
library. Nothing teaches a new programmer how NOT to do something like
being able to explain exactly why what they are doing is wrong, rather
than point to some tutorial book that says, "Don't do this." Short of
understanding the standard I see no other way to accomplish this.

Yet further, who says it's all MY code I have to understand?? Have you
never worked on something written by someone else? Have you never been
stuck trying to make heads or tails of some pile of spaghetti that some
lone wolf "expert" wrote? Guess you haven't since you never have to
look at the standard.

You can tell people that they don't need the standard all you want. I
strongly disagree. Your complaint that using the standard to make sure
code is compliant and to ascertain exactly what's wrong under certain
"limit" conditions is nothing but an opinion. I think it's a crock. I
suppose for those who don't care if they know C++ fully can get by
without the standard, but ANYONE that wants to develop expert level
knowledge absolutely needs it and every workplace should have a language
lawyer in it.

As to your insistence that my code, which you've never seen an example
of, would never pass review at your place of work...that's just a plain
ignorant statement. It tells me with absolute certainty that your
opinions are not at all based on fact or evidence but simply your own
thick headedness. It also tells me that, since you don't need the
standard, that standard compliance is not important at your place of
work and is not considered in review. It is certainly my opinion that
this should be a minor concern at the least (knowing full well it's way
too easy to write non-compliant code without knowing it until a compiler
upgrade or switch).

I'll let you know a little known secret: once you become so stubborn and
set in your ways that you can tell someone their code is shit without
even seeing it, your ability to learn anything new has become incredibly
limited. Hopefully you're correct in your assessment and have nothing
new to learn anyway. I doubt that very much though.

0 new messages