Do you have the C or C++ standard? (serious question)

C

Chris Hills

Victor said:
Chris said:
Victor Bazarov said:
Chris Hills wrote:
[..]
I have asked this question in several places and the majority have
said they do not have a copy of the language standard for c or C++

Many have the K&R2 or the BS books but as far as most are concerned
the compiler manuals are more important than the standard.

Well, good for you!

What is? I don't follow your logic

That you're satisfied with the majority of answers in the places you
asked.

It is a straw pole. No more representative than any other opinion pole.
No matter whether it's representative of "all programmers", or
whether it's acceptable as a proof of anything, if you are talking of
it, you must like it. I am glad for you. That's my logic. You don't
have to follow it. I am just commending on your achievement.

You not appear to have any logic just a rant.
How many did you ask? How many programmers are there? What's your
expected margin of error when conducting a poll of that sort (it is
possible that all answer truthfully and never forget about it)? Is
the number of programmers you've asked larger than the margin of error?

Make of it whatever you like, but always supply a disclaimer about how
trustworthy your statistical information is.

You seem to have a problem I suggest you deal with it before
communicating with people

A statement was made that "all programmers have a copy of the standard"
so I was asking the question in several places...

The original statement was made using a very small highly skewed sample.
Certainly far smaller than any margin of error.

As I said "so far" if on going "it appears" ie it is not a full result.

SO if you have nothing helpful to contribute go away.
 
C

Chris Hills

[QUOTE="pete said:
Hi,

It came up in a standards panel meeting
the other day that "all c or C++
programmers" have a copy of ISO C and/or C++ ...

I challenged this and said most don't (outside those working on the
standards).

I would guess that the percentage of regulars here
that do have a copy,
is much higher than the percentage of all C programmers
that have a copy.[/QUOTE]

I would agree also most who have a copy will say so where as most who
don't probably will not comment.

However this is not the only place I asked. As the groups are
completely different I did not cross post.

In the C and C++ Language areas "quite a few" (scientific technical
term :) do have some sort of copy of the standard from a proper copy
through various older versions to those with the draft texts.

However in the actual application, OS embedded etc groups the number is
far lower.
 
C

Chris Hills

If this is the full extent of the C++ committees concerns, I reckon C++
is dead meat.

I was one comment passed over coffee.
It was not an ISO C or C++ panel meeting.
 
K

kwikius

Chris said:
I was one comment passed over coffee.
It was not an ISO C or C++ panel meeting.

Hey, no problem. I guess that was a bit fierce.

The way I came to C++ was from Microsoft QuickC. I then got MSVC V1.0.
For a while the MSVC help file was my manual and while I was doing
simple stuff that worked out OK, but it was tough going at first.
Anyone remember scribble demo app?. As I really liked the way C++
worked after QuickC, so my Dad bought me Bjarne Stroustrups , The C++
Programming language, 2nd edition, and so that was my manual. IIRC I
moved from VC1. to VC6 at some stage as there was a cheap version for
sale. I tried some template stuff but found that weird things happened,
so this put me off templates at that time.

Next I got hold off VC7.1. The difference was amazing. Suddenly I could
start to do things with templates and I bought Vandevoorde and
Josuttis C++ templates book, and with VC7.1 most of the stuff worked.

I started looking around for a copy of the C++ standard around that
time just to check a few points here and there regarding what I was
doing. Eventually my good old bro' bought me the official C++ standard.

The point of this is, I think you can go an awful long way without
needing the Standard, but there will come a point where its really nice
to have it, but like everything it costs money, so its not essential.

It so happens that the way C+ is designed things usually just work the
way you think they should work, and that is the beauty of it.

And thanks to everyone who has put all the time in to get the C++
standard where it is today. Its quite a big part of my life these days.

regards
Andy Little
 
Y

Yevgen Muntyan

Ivan said:
I am just a user of the C++ language (albeit an "advanced" one).
Yet I studied the standard because I care for formal correctness
of my programs.
Unfortunately, if feel I am in a small minority (<5%?).
I take it as my responsibility to write code that actually works
according to the formal specification of the language.

So you believe that your programs are actually correct because
you are trying to make them correct? Even if you don't consider
*very* important obvious easy bugs like reading from NULL
(substitute with an analogous thing in C++), can you prove that your
programs are conforming to standard in those places that actually
require reading standard, e.g. those are not covered in faqs and
textbooks?
It is sad, but most (C++) programmers seem to satisfy themselves
with knowing that their code passes casual tests, or at best,
available test cases. They don't even care about undefined
behavior and the invisible failures/leaks that may come with it.
They never go beyond reading recipe books (a la "Effective C++").

What you said is indeed bad, but not having/reading (all the time,
having it on your desktop, sleeping with it and so on) the standard
doesn't mean bad programming.

Reading from NULL is undefined behavior, isn't it? Most C and C++
programmers know they should not try to access memory pointed by
NULL without any standard, still it happens all the time (not all the
time in C++ I guess, but you have similar easy problems, don't you).

Of course standard is important, but having standard won't make
bugs disappear, and a programmer who doesn't give a dead cat to
The Standard /insert the year here/ but makes sure he checks all
pointers in his program is a better programmer than that reading
standard day and night and making simple mistakes because he
believes he doesn't make them ;)

I don't mean *you* are a bad programmer or something, but putting
"don't even care about undefined behavior and the invisible
failures/leaks" here as if it was an attribute of not-having-a-standard
programmer is not fair.

By the way, to my shame, I find C Faq far more useful than latest
C standard. In C++ the situation must be different since you often
need to determine whether something is your bug or compiler bug, while
in C you can safely suspect yourself but not the compiler ;)

Best regards,
Yevgen
 
I

Ivan Vecerina

: Ivan Vecerina wrote:
: > I am just a user of the C++ language (albeit an "advanced" one).
: > Yet I studied the standard because I care for formal correctness
: > of my programs.
: > Unfortunately, if feel I am in a small minority (<5%?).
: > I take it as my responsibility to write code that actually works
: > according to the formal specification of the language.
:
: So you believe that your programs are actually correct because
: you are trying to make them correct?

Of course not, and using test cases etc is a crucial thing (too).

: Even if you don't consider
: *very* important obvious easy bugs like reading from NULL
: (substitute with an analogous thing in C++), can you prove that your
: programs are conforming to standard in those places that actually
: require reading standard, e.g. those are not covered in faqs and
: textbooks?

No, but if I do not care about what is formally correct, I may:
- dereference the one-past-the-end address of an array,
or do arithmetic outside its valid range of addresses.
- reinvent my own offsetof macro (or, in C++, use it on a non-POD
type), which (at least in C++) cannot portably be done.
- forget about events that will cause iterator invalidation
on the particular container that I am using (C++).
- forget that the result of the division or modulo of a negative
integer may depend on the target platform
- forget to implement a placement-delete operator function
matching my placement-new operator (to pick one of the many
dark corners of the C++ language).
- write code that is not exception safe, not thread safe.
- forget about buffer overflows and other security risks...
These are just few random picks...

: > It is sad, but most (C++) programmers seem to satisfy themselves
: > with knowing that their code passes casual tests, or at best,
: > available test cases. They don't even care about undefined
: > behavior and the invisible failures/leaks that may come with it.
: > They never go beyond reading recipe books (a la "Effective C++").
:
: What you said is indeed bad, but not having/reading (all the time,
: having it on your desktop, sleeping with it and so on) the standard
: doesn't mean bad programming.

Yet isn't it important to be aware that a formal specification exists?

There are often many ways to write code that will work and pass
test cases. Yet usually a good fraction of those "working
implementations" will have portability, reliability, or security
issues. To be able to choose among the many working approaches,
it is important to understand what is formally correct, and
what isn't.
This has eventually driven me to be *wanting* to consult the standard.

: Reading from NULL is undefined behavior, isn't it? Most C and C++
: programmers know they should not try to access memory pointed by
: NULL without any standard, still it happens all the time (not all the
: time in C++ I guess, but you have similar easy problems, don't you).
NULL-dereferencing is now captured as a runtime error on most
platforms, just as standard C++ library implementations are
providing debug modes that can capture many usage errors.
But in C like in C++, there are many other ways to silently
trigger undefined or platform-specific behavior.

: I don't mean *you* are a bad programmer or something, but putting
: "don't even care about undefined behavior and the invisible
: failures/leaks" here as if it was an attribute of
not-having-a-standard
: programmer is not fair.
This is not what I intended to express, and I am sorry if this
is how my post was understood. I admitted myself using an outdated
copy of the C++ standard, and a pre-final version of the C standard;
I would be worried by a developer who has only read the standard
specification, and none of the great books about C and C++.

But I do believe that a professionnal C or C++ developer who does
care about the correctness of his work is very likely to be drawn to
reading and studying portions of the language specification,
as well as a number of great books (such as those that have a "highly
recommended" rating in ACCU's book reviews for advanced C/C++).

: By the way, to my shame, I find C Faq far more useful than latest
: C standard. In C++ the situation must be different since you often
: need to determine whether something is your bug or compiler bug, while
: in C you can safely suspect yourself but not the compiler ;)

It is very true that in C++, non-compliances of compilers and libraries
has amplified the importance of having access to the formal spec.
Finding C++ platform bugs still happens to me in 2006...


Kind regards,
Ivan
 
M

Michael Wojcik

Well, do most of you have a copy of the relevant ISO language standard
of your own or is there one on your desk at work?

For C90 I have Schildt's _Annotated_, which has all but one page of
ISO 9899:1990; Plauger & Brodie's _Standard C_; a plain-text
version of the missing page (part of the fprintf specification) from
the Schildt copy of the standard; and K&R2.

For C99 I have the ANSI PDF of 9899:1999; the official PDFs of Cor1
and Cor2; the official PDF of the C99 Rationale; and the PDF draft of
TC1 (N1124).

N1124 is what I usually use for reference, with the C90 copy in the
Schildt coming in second place.

I rarely use C++, and when I do I try to stay away from the dark
corners, so there I make do with Stroustrop's Special Edition. If
I ever have to do serious C++ programming I'll commit the 18USD to
my own copy of that standard.

I also have the COBOL 2002 standard, in PDF.

--
Michael Wojcik (e-mail address removed)

He smiled and let his gaze fall to hers, so that her cheek began to
glow. Ecstatically she waited until his mouth slowly neared her own.
She knew only one thing: rdoeniadtrgove niardgoverdgovnrdgog.
 
R

Richard Heathfield

Michael Wojcik said:
For C90 I have Schildt's _Annotated_, which has all but one page of
ISO 9899:1990;

I trust you have torn out and burned all the annotations. :)
 
K

Keith Thompson

Richard Heathfield said:
Michael Wojcik said:

I trust you have torn out and burned all the annotations. :)

Let me know when you've figured out how to do that. :cool:}

(For the unaware: the annotations, which are dangerously incorrect,
are printed on opposite pages to the standard itself. See
<http://www.lysator.liu.se/c/schildt.html> (but the server is down at
the moment).)
 
K

kim

I don't.
I've never even read the C or C++ standards. Or K&R for that matter.

I originally learnt C by reading the books that came with Borland or
Turbo C 1.something and C++ by reading the ones that came with Borland
C++ 3.0. (I think. It may have been 2.something.)

Portability was never a priority for me or any of my employers; my code
has always targeted specific platforms, that didn't necessarily follow
the standard that closely.

The singular exception to this, was library code written to compile on
an embedded platform using a (somewhat buggy) IAR compiler and on the
PC with Borland; but almost all (or possibly actually all - it's been a
while) of the code that didn't bugger up the IAR compiler, ran
perfectly on Borland.

Despite this, at the two places I've worked for the last nearly 15
years, I've been the guy other coders refer to on C and C++ matters.
Even the kinkier aspects.
Scary, isn't it? :)

I do have the special edition of Stroustrup's "The C++ Programming
Language" and Josuttis', IMHO utterly indispensable, "The C++ Standard
Library".
 
C

Chris Hills

Keith Thompson said:
Let me know when you've figured out how to do that. :cool:}

(For the unaware: the annotations, which are dangerously incorrect,
are printed on opposite pages to the standard itself. See
<http://www.lysator.liu.se/c/schildt.html> (but the server is down at
the moment).)

At the time the book was published many said that the standard cost
120 USD and the book 30 USD thereby indicating the added value of the
authors annotations....
 
M

Marco

Chris said:
Hi,

It came up in a standards panel meeting the other day that "all c or C++
programmers" have a copy of ISO C and/or C++ ...

I challenged this and said most don't (outside those working on the
standards).

Well, do most of you have a copy of the relevant ISO language standard
of your own or is there one on your desk at work?

I have both the C and C++ standard in PDF. Most of my co-workers
don't. I would say most developers use a popular language book as a
reference not the standard.
 
M

Michael Wojcik

Michael Wojcik said:

I trust you have torn out and burned all the annotations. :)

No, I conscientiously avert my eyes from them instead, as an exercise
in rigor, and leave them as a trap for unwary book-thieves.

--
Michael Wojcik (e-mail address removed)

Pocket #16: A Ventriloquist's "Helper" -- Recordings for Divers Occasions,
especially cries to put in the mouths of enemies -- "God Bless Captain
Vere!" "Les jeux sont faits!" &c. -- Joe Green
 
A

Anthony Irwin

Jack said:
Most C programmers have a copy of K&R2 on their shelf, I don't see
nearly as many copies of Stroustrup (any version) on the C++
programmers' shelves. Other books abound, including H&S for the C
programmers, but there are also a distressingly large number of
Schildt books.

Hi I was just wondering what is wrong with the Schildt books? I
purchased the C++ the compleate reference and C the compleate reference
both 4th edition books. The purpose was to have a language reference, I
was under the impression that both these books covered the standards.

I remember reading that the C reference first covered the c89 standard
then gives the c99 standard.

I am just starting to learn C so was wondering if there is anything in
those books that will lead me in the wrong direction.

I am going to be programming on unix based systems gnu/linux and freebsd
mainly.

Kind Regards,
Anthony Irwin
 
R

Richard Heathfield

Anthony Irwin said:
Hi I was just wondering what is wrong with the Schildt books?

Nothing at all, assuming you just needed some kindling.
I
purchased the C++ the compleate reference and C the compleate reference
both 4th edition books. The purpose was to have a language reference, I
was under the impression that both these books covered the standards.

Then you might want to give some thought to sueing the publisher. :)

From time to time, people try to count the bugs in Schildt's understanding
of C and C++, but invariably they lose count and have to start again.

I would give you a little list to get you started, but Seebs did one years
ago, so I'll find you a URL to that, instead:

http://herd.plethora.net/~seebs/c/c_tcr.html

Peter Seebach is on the ISO C Committee, by the way. Here's another, this
one from Clive Feather (who is also on the ISO C Committee):

http://www.lysator.liu.se/c/schildt.html (temporarily down, but bookmark it
for later)

And here's a nasssty trick Peter played on the good folks of clcm (note the
posting date):

http://groups.google.com/group/[email protected]

I remember reading that the C reference first covered the c89 standard
then gives the c99 standard.

I am just starting to learn C so was wondering if there is anything in
those books that will lead me in the wrong direction.

I think that's true. That is, just about anything in those books will lead
you in the wrong direction.
I am going to be programming on unix based systems gnu/linux and freebsd
mainly.

"The C Programming Language", 2nd edition, by Kernighan and Ritchie.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top