Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Difference in C++ Standard Library
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
"Girish Shetty"  
View profile  
 More options Jun 14 2005, 10:03 am
Newsgroups: comp.std.c++
From: girish.she...@nokia.com ("Girish Shetty")
Date: Tue, 14 Jun 2005 14:03:04 GMT
Local: Tues, Jun 14 2005 10:03 am
Subject: Difference in C++ Standard Library
Hi All,

I have got two different implementation of C++ Standard Library, and there
are lots of difference between them !!

I have downloaded these two:

gcc-4.0.0.tar.gz

libstdc++-2.8.1.1.tar.gz

For example, In case of gcc-4.0.0.tar.gz,

ifstream is defined as :

typedef basic_fstream<char> fstream; ///< @isiosfwd

And the only two constructers provided by the basic_fstream class are:

basic_fstream()

basic_fstream(const char* __s, ios_base::openmode __mode = ios_base::in |
ios_base::out)

Again, APIs (with parameter) differ in this case..

Where in case of libstdc++-2.8.1.1.tar.gz, its defined like this:

class fstream : public fstreambase, public iostream {

public:

fstream() : fstreambase() { }

fstream(int fd) : fstreambase(fd) { }

fstream(const char *name, int mode, int prot=0664)

: fstreambase(name, mode, prot) { }

fstream(int fd, char *p, int l) : fstreambase(fd, p, l) { } /*Deprecated*/

void open(const char *name, int mode, int prot=0664)

{ fstreambase::open(name, mode, prot); }

};

Which matches with Windows C++ Standard Library.

Now the confusuon is, which one is as per the standard ?

Regards

Girish

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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
P.J. Plauger  
View profile  
 More options Jun 14 2005, 11:58 am
Newsgroups: comp.std.c++
From: "P.J. Plauger" <p...@dinkumware.com>
Date: Tue, 14 Jun 2005 09:58:46 CST
Local: Tues, Jun 14 2005 11:58 am
Subject: Re: Difference in C++ Standard Library
""Girish Shetty"" <girish.she...@nokia.com> wrote in message

news:Rnure.2104$_k2.36918@news2.nokia.com...

> I have got two different implementation of C++ Standard Library, and there
> are lots of difference between them !!

Not unusual.

These are the two constructors required by the C++ Standard.

> Again, APIs (with parameter) differ in this case..

> Where in case of libstdc++-2.8.1.1.tar.gz, its defined like this:

> class fstream : public fstreambase, public iostream {

Ah, now this is a problem. The C++ Standard requires that
fstream be a typedef for template class basic_fstream<char>
(as above). You're looking at either a very old library or
the "traditional" iostreams sometimes shipped with a
standard-conforming library.

> Which matches with Windows C++ Standard Library.

The first one. Some releases of VC++ also include the old
headers with names like iostream.h (note the .h on the end)
which implement the traditional library. But you should
avoid using these headers in modern code, and *never*
mix old and new.

> Now the confusuon is, which one is as per the standard ?

The first one.

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com

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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
chris jefferson  
View profile  
 More options Jun 14 2005, 11:04 am
Newsgroups: comp.std.c++
From: c...@cs.york.ac.uk (chris jefferson)
Date: Tue, 14 Jun 2005 15:04:33 GMT
Local: Tues, Jun 14 2005 11:04 am
Subject: Re: Difference in C++ Standard Library

Girish Shetty wrote:
> Hi All,

> I have got two different implementation of C++ Standard Library, and there
> are lots of difference between them !!

> I have downloaded these two:

> gcc-4.0.0.tar.gz

> libstdc++-2.8.1.1.tar.gz

 From the libstdc++ homepage

What... is your name?

The GNU Standard C++ Library v3, or libstdc++-v3. Older snapshots of
this library were given the name libstdc++-2.9x up until the release of
GCC 3. This is a complete rewrite from the previous libstdc++-v2.

gcc-4.0.0 (and all versions of gcc 3) come with a copy of libstdc++-v3.
libstdc++-v2 is unmaintained and shouldn't be used unless you have a
very good reason for it. Any differences you found are almost certainly
signs of old pre-standardisation which were removed when libstdc++-v3
came out.

If you want to compare versions of the standard library, compare
libstdc++-v3 (which came with gcc-4.0.0) with rougewave
(http://www.roguewave.com/opensource/index.cfm) and STLport
(http://www.stlport.org) (as two random examples, I'm not claiming these
are good, or better than other options. They are free however). You
should find much fewer differences.

Chris

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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marc Schoolderman  
View profile  
 More options Jun 14 2005, 1:34 pm
Newsgroups: comp.std.c++
From: squ...@alumina.nl (Marc Schoolderman)
Date: Tue, 14 Jun 2005 17:34:07 GMT
Local: Tues, Jun 14 2005 1:34 pm
Subject: Re: Difference in C++ Standard Library

Girish Shetty wrote:
> I have got two different implementation of C++ Standard Library, and there
> are lots of difference between them !!

Yes, I've seen that often, especially in the I/O library. Some
implementations are implemented as per the letter of the standard (e.g.
when to throw badbit/failbit - some implementations never throw without
setting badbit because of some ambiguous wording in the original
standard, if I recall correctly), whereas others implement what the
Standard was actually intending to say.

> ifstream is defined as :
> And the only two constructers provided by the basic_fstream class are:
> basic_fstream()
> basic_fstream(const char* __s, ios_base::openmode __mode = ios_base::in |
> ios_base::out)

This is correct.

> Where in case of libstdc++-2.8.1.1.tar.gz, its defined like this:
> class fstream : public fstreambase, public iostream {

This is incorrect. According to the standard, std::fstream must be a
typedef for basic_fstream<char>.

Also, if I'm not mistaken, libstdc++ 2.8.1.1 is a VERY old version of
the GNU libstdc++-v2 series. They've since switched to libstd++-v3 which
is included with every G++ release. I wouldn't be surprised if libstdc++
2.8.1.1 is from a time when there was no (formal) C++ Standard! :)

~Marc.

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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »