Topic: backward compatibility according to std?


Author: comeau@panix.com (Greg Comeau)
Date: Sat, 27 Oct 2001 09:31:46 GMT
Raw View
In article <U5MB7.2497$Le.62768@sea-read.news.verio.net>,
Kaleb Pederson  <kibab@boink.net> wrote:
>> > However, most compilers offer similar <name.h> headers as non-standard
>> > exceptions. Just remember that any code you write that uses the old
>> > headers has behavior that in the long run is unpredictable. You're
>> > better off switching to the new <name> headers as soon as possible, even
>> > if that requires you to re-write your code.
>
>I think what was being said was that, generally, <iostream.h> and other
><name.h> files are included as "non-standard exceptions" that don't use the
>std:: namespace.  I'm going to see clarification on this aspect but the
>above is what I understood.

For every Standard C header <name.h>, Standard C++ supports a
respective <Cname> header.  Standard C++ also support every
<name.h> header found in Standard C, although folks consider
the latter deprecated headers for C++.   Since <iostream.h> is
not a Standard C header, Standard C++ doesn't know anything about it,
so yes, if supported, it would be and extension, and do whatever
the vendor says it does.  <name.h> header is C++ are not an extension.
But it is good advice to stick with <Cname> headers whenever possible.
--
Greg Comeau         export ETA: December     See our Oct 31st special
Comeau C/C++ ONLINE ==>     http://www.comeaucomputing.com/tryitout
World Class Compilers:  Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: Kaleb Pederson <stufin02@mail.ewu.edu>
Date: Tue, 23 Oct 2001 21:21:46 GMT
Raw View
An instructor of mine and I have been having the a discussion on backward
compatibility.  Does the standard define that backward compatibility to
earlier versions of the standard must be enforced by compliant compiler
writers?  Does the standard ever enforce backward compatibility or does the
latest version of the standard supplant all previous versions?

--Kaleb Pederson

Our conversation was as follows:

> hmm.  It seems to me that the standard is a standard.  We either follow
it,
> or we don't, or because compilers don't support the full standard yet, we
do
> our best to be as compliant as possible.  It seems that it is the compiler
> writers, not the standard, that allow us to use old conventions.  But
that's
> what happens as standards change; compilers slowly move to support new
> features and fade out old ones.

But the standard itself requires backward compatibility, right?
That means the old way is still part of the standard:  IOW, the standard
allows you to ignore namespaces, and requires compilers to be written
such that namespaces can be ignored.  On the other hand, I may be wrong
about that since I haven't actually read the standard.  That's just what
I vaguely thought I heard somewhere.  I know, I know, I should be better
informed, but (1) I'm an engineer (sloppy sloppy, as long as it works)
and (2) I have too many other things to do these days.


---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: "James Russell Kuyper Jr." <kuyper@wizard.net>
Date: Wed, 24 Oct 2001 00:04:36 GMT
Raw View
Kaleb Pederson wrote:
>
> An instructor of mine and I have been having the a discussion on backward
> compatibility.  Does the standard define that backward compatibility to
> earlier versions of the standard must be enforced by compliant compiler

There are no earlier versions of the standard. 1998 was the year that
the first version of the standard came out. When people refer to
backward compatibility before 1998, they're referring to ARM C++, or in
some case even C90.

> writers?  Does the standard ever enforce backward compatibility or does the
> latest version of the standard supplant all previous versions?

Many features of the standard were designed the way the were, in order
to allow as much backward compatibilty as could reasonably be achieved.
However, there's no sense in which backward compatibility is enforced.
It's an imperfectly achieved goal, not a guarantee. The standard is the
standard, and while it has a historical connection to earlier versions
of C++, and even of C, it defines a language that is distinct from any
previously existing language. For that matter, it defines a language
that is not quite the same as that implemented by any current compiler.

...
> But the standard itself requires backward compatibility, right?

No.

> That means the old way is still part of the standard:  IOW, the standard
> allows you to ignore namespaces, and requires compilers to be written
> such that namespaces can be ignored.  On the other hand, I may be wrong

All of the headers borrowed from C are available in C++ in two forms,
for instance <stdio.h> and <cstdio>. The <cname> headers use "std::",
but if you use the <name.h> form, you can access those functions without
using "std::". However, the C++ standard library headers are available
only in the "std::" form. You can't use them without using namespaces.
If you want to use std::vector<T>, you're going to have to use "std::",
one way or another. However, a "using std;" declaration (which I most
definitely do not recommend) will do the job.

However, most compilers offer similar <name.h> headers as non-standard
exceptions. Just remember that any code you write that uses the old
headers has behavior that in the long run is unpredictable. You're
better off switching to the new <name> headers as soon as possible, even
if that requires you to re-write your code.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: Francis Glassborow <francis.glassborow@ntlworld.com>
Date: Wed, 24 Oct 2001 00:13:53 GMT
Raw View
In article <3bd5da2a@dnews2.ewu.edu>, Kaleb Pederson
<stufin02@mail.ewu.edu> writes
>An instructor of mine and I have been having the a discussion on backward
>compatibility.  Does the standard define that backward compatibility to
>earlier versions of the standard must be enforced by compliant compiler
>writers?  Does the standard ever enforce backward compatibility or does the
>latest version of the standard supplant all previous versions?

Those working on a release of a Standard consider maintaining backward
compatibility important but when the ink dries on a Standard that is it
and it supersedes all previous versions. There have sometimes been
problems in that individual countries have insisted on retaining an
earlier version as their national standard but that is a different
issue.

At the moment this is not an issue because there has only ever been one
C++ standard, the current one.


Francis Glassborow
I offer my sympathy and prayers to all those who are suffering
as a result of the events of September 11 2001.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: comeau@panix.com (Greg Comeau)
Date: Wed, 24 Oct 2001 11:49:45 GMT
Raw View
In article <3bd5da2a@dnews2.ewu.edu>,
Kaleb Pederson  <stufin02@mail.ewu.edu> wrote:
>An instructor of mine and I have been having the a discussion on backward
>compatibility.  Does the standard define that backward compatibility to
>earlier versions of the standard must be enforced by compliant compiler
>writers?

I would imagine that some standards do this, but the C++ one doesn't.
It only talks about itself.   It does deprecated some features,
but that another story.

>Does the standard ever enforce backward compatibility

Only for features which are the same :)

>or does the
>latest version of the standard supplant all previous versions?

It supplants them.  Actually, in the case of C++, no ISO Standard
C++ existed, as there has only ever been one.   There were some
non-ISO versions before that, but that's another story too as far
as ISO is concerned.

>Our conversation was as follows:
>> hmm.  It seems to me that the standard is a standard.

Clearly :)

>>  We either
>> follow it, or we don't, or because compilers don't support the
>> full standard yet, we do our best to be as compliant as possible.

Ok.

>> It seems that it is the compiler writers, not the standard, that
>> allow us to use old conventions.

True, but of course this could mean running compilers in non-standard modes.

>> But that's what happens as standards change; compilers slowly move
>> to support new features and fade out old ones.

IOWs, some vendors provide transition models for users to consider.

>But the standard itself requires backward compatibility, right?

No.

>That means the old way is still part of the standard:

Not if a feature changes.  Again though, note that there has
only ever been one ISO Standard C++.

>IOW, the standard
>allows you to ignore namespaces, and requires compilers to be written
>such that namespaces can be ignored.

No, it doesn't.   Of course, all programs don't need to use
namespaces, but if you use a namespace, then the compiler is required
to support it.

>On the other hand, I may be wrong
>about that since I haven't actually read the standard.  That's just what
>I vaguely thought I heard somewhere.  I know, I know, I should be better
>informed, but (1) I'm an engineer (sloppy sloppy, as long as it works)

engineer != sloppy

>and (2) I have too many other things to do these days.

Hmmm.
--
Greg Comeau         export ETA: December     See our Oct 31st special
Comeau C/C++ ONLINE ==>     http://www.comeaucomputing.com/tryitout
World Class Compilers:  Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: Kaleb Pederson <kibab@boink.net>
Date: Wed, 24 Oct 2001 11:50:01 GMT
Raw View
Thanks Francis and James.  I didn't quite realize that the current version
of the standard was the first and only official version.  I presumed that
the draft I had was a draft revision, not the initial draft.

Again, thanks for the info.

--Kaleb

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: Kaleb Pederson <kibab@boink.net>
Date: Thu, 25 Oct 2001 16:38:27 GMT
Raw View
Okay, I think I pretty much understood, but I wanted to verify, hence, my
interpretation of what was said is as follows (again, this is part of a
conversation between me and one of my instructors).

> The standard says all the C headers will still be available as
> <name.h>, so I'm safe on that front.
>
> Would you agree?

Ummm - good question.  Let me see what was said:

> > However, most compilers offer similar <name.h> headers as non-standard
> > exceptions. Just remember that any code you write that uses the old
> > headers has behavior that in the long run is unpredictable. You're
> > better off switching to the new <name> headers as soon as possible, even
> > if that requires you to re-write your code.

I think what was being said was that, generally, <iostream.h> and other
<name.h> files are included as "non-standard exceptions" that don't use the
std:: namespace.  I'm going to see clarification on this aspect but the
above is what I understood.

--Kaleb Pederson

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: "James Kuyper Jr." <kuyper@wizard.net>
Date: Thu, 25 Oct 2001 23:58:50 GMT
Raw View
Kaleb Pederson wrote:
...
> I think what was being said was that, generally, <iostream.h> and other
> <name.h> files are included as "non-standard exceptions" that don't use the
                                               ^^^^^^^^^^
                                               extensions

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]