Topic: Discovering C++


Author: comeau@panix.com (Greg Comeau)
Date: Sun, 20 May 2001 23:47:56 CST
Raw View
In article <pLSL6.122$UB2.3413@nreader1.kpnqwest.net>,
Paulo Pinto <pjmlp_pt@yahoo.com> wrote:
>"Bjarne Stroustrup" <bs@research.att.com> wrote in message
>news:GDBzCy.89q@research.att.com...
>> "Paulo Pinto" <paulo.pinto@altitudesoftware.com> writes:
>> > I've assembled a FAQ with a small set of changes that
>> > have happened to C++ since the standard process has ended....
>> That is a good aim. However, *no* changes has happened since the standard
>> was ratified in 1998.
>>
>> There will be a small number of defects corrected by an upcoming TR (or is
>> that a technical corrigendum?), but those are technical and at a level of
>> detail far below what you are presenting. That TC hasn't yet been issued.
>
>What I really meant was to provide a way for people like some of
>my work colleges to "upgrade" their knowlege. Most of them don't
>know what templates are. They were surprised to know about namespaces,
>and so on. So what I really want is to provide a way for people
>in similar situation, to know C++ better since they lost control
>with their teacher, book, whatever.

Too though, many good books exist which include sections and
whole chapters on these topics.  Moreover, they can approach
the features beyond syntax and tap in conceptual, design, and
technique aspects.

>> C-style cast are *not* deprecated.
>
>But I really thought so. I mean will C++0x still support them ?
>I was sure to have read that somewhere, but if you say that they aren't.
>They aren't.

May I suggest you get a copy of Standard C++?

>> You can use "typename" instead of "class" when declaring a template
>> argument, but you don't have to and not everyone recommend that usage.
>
>I will modify that.

Some additional words which may help :
http://www.comeaucomputing.com/techtalk/templates/#typename
--
Greg Comeau                 Comeau C/C++ 4.2.45.2
ONLINE COMPILER ==>         http://www.comeaucomputing.com/tryitout
NEW: Try out libcomo!       NEW: Try out our C99 mode!
comeau@comeaucomputing.com  http://www.comeaucomputing.com

---
[ 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: Tue, 15 May 2001 23:29:19 GMT
Raw View
In article <remove.haberg-1505010950300001@du135-226.ppp.su-
anst.tninet.se>, Hans Aberg <remove.haberg@matematik.su.se> writes
>In article <u8BeTbB$h$$6Ew+S@ntlworld.com>, Francis Glassborow
><francisG@robinton.demon.co.uk> wrote:
>>Another feature here is that, IIRC, the two forms of the C headers have
>>a subtle difference, the C form provides the names in the global
>>namespace while the C++ form provides them in std.
>
>Both headers put the names in the "std" namespace, but the C headers adds
>the "using namespace std" directive. On my compiler this works so that one
>alters the name lookup paths; conflicting names can still be resolved by
>writing out the full name. So they are not put into the global namespace
>by the "using" directive.

I think this is confused hair-splitting.

Francis Glassborow      ACCU
64 Southfield Rd
Oxford OX4 1PA          +44(0)1865 246490
All opinions are mine and do not represent those of any organisation

---
[ 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: Pete Becker <petebecker@acm.org>
Date: Tue, 15 May 2001 23:32:24 GMT
Raw View
Hans Aberg wrote:
>
> Both headers put the names in the "std" namespace, but the C headers adds
> the "using namespace std" directive.

That doesn't conform to the standard. The only correct way for the
standard headers to pull names from std into the global namespace is
with using declarations:

using std::whatever;

A using directive isn't selective enough -- it pulls everything in, not
just the names defined in a particular header.

--
Pete Becker
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-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: Mon, 14 May 2001 23:01:01 GMT
Raw View
In article <XYRL6.109$UB2.2847@nreader1.kpnqwest.net>, Paulo Pinto
<paulo.pinto@altitudesoftware.com> writes
>The problem is that the mailer broke the link, please copy the
>full link to the url window.

OK, pity you had to post the full URL without any wildcards.

Having had a quick look, I think you might need to revisit much of what
you write. Let me give you a few examples:

The reason for changing the names for the standard headers is exactly
that previously there was no standard. Some compilers used .h, some used
.hxx, some .hpp etc. The only fair way was to invalidate all of them and
at the same time remind programmers that standard headers are not files,
they just unlock specific parts of the library namespace (yes, most
implementations provide this feature by mapping standard headers to
files, but they are not required to do so)

Another feature here is that, IIRC, the two forms of the C headers have
a subtle difference, the C form provides the names in the global
namespace while the C++ form provides them in std.

I disagree with the statement you make about typename. In the context of
template parameter lists, typename and class are fully interchangeable
and are likely to remain so for the foreseeable future. Some programmers
prefer one, some the other and some like to use typename when built-in
types work and class when they do not (as a way of documenting this to
users). There is no should about using typename in this context.

You touch on such arcane things as member templates (should not be used
by those who are not bang up to date with their C++) while ignoring the
myriad of little changes that may even be silent (i.e. will not trigger
a diagnostic)

The semantics of the conditional operator have been changed from those
in the ARM

You are now allowed to delete a const pointer even when it is passed as
an argument to a function. I think this is right, but it could come as a
nasty shock to someone who did not expect it.


But much more important is that good C++ style has changed radically. No
simple summary can cover that. Little things like how you write an
assignment operator. Or big things like writing exception safe code.

I know that you are well intentioned, but actually documenting all those
things that have changed since the earlier days is complicated. In one
way little has changed, there have been a cluster of new keywords, a few
major introductions (templates, exceptions and namespaces) but that is
it. OTOH everything has changed because the way C++ is written has been
changed by those introductions and by the accumulated wisdom of the
serious C++ community.

Unfortunately, the people you really need to communicate with think they
know already. Those that read a book or two a year (selecting carefully)
or subscribe to at least one quality magazine (not much choice these
days, either get CUJ, or join ACCU -- now you can all yell about how you
know about other well informed C++ publications) or subscribe to
comp.lang.c++.moderated already know that C++ usage is maturing. Those
that do not will read your page and probably fail to realise that they
need to work much harder to come up to date. Fortunately most of them
will eventually give up, claim C++ is always changing and move to Java
(which is always changing, you know that when writing about language
problems, C++ authors tell you how to avoid them, while Java ones tell
you to learn to live with them:)



Francis Glassborow      ACCU
64 Southfield Rd
Oxford OX4 1PA          +44(0)1865 246490
All opinions are mine and do not represent those of any organisation

---
[ 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: "Paulo Pinto" <paulo.pinto@altitudesoftware.com>
Date: Mon, 14 May 2001 23:02:05 GMT
Raw View
"Bjarne Stroustrup" <bs@research.att.com> wrote in message
news:GDBzCy.89q@research.att.com...
>
> "Paulo Pinto" <paulo.pinto@altitudesoftware.com> writes:
>
> > Hello,
> >
> > I've assembled a FAQ with a small set of changes that
> > have happened to C++ since the standard process has
> > ended. My ideia is that it helps people that aren't
> > well aware of has happened to their favorite language :)
>
> That is a good aim. However, *no* changes has happened since the standard
> was ratified in 1998.
>
> There will be a small number of defects corrected by an upcoming TR (or is
> that a technical corrigendum?), but those are technical and at a level of
> detail far below what you are presenting. That TC hasn't yet been issued.

Yes, you are right. I should have said that in a different way.
What I really meant was to provide a way for people like some of
my work colleges to "upgrade" their knowlege. Most of them don't
know what templates are. They were surprised to know about namespaces,
and so on. So what I really want is to provide a way for people
in similar situation, to know C++ better since they lost control
with their teacher, book, whatever.

>
>
> > So I invite you to come to the site and tell me what
> > do you think of it. What information is incorrect, what
> > should be corrected. Whatever.
>
> Comments:
>
> The "changes" you list are in the standard (are *not* changes since
> the standard). Furthermore, several of the "changes" listed are
> features that were widely implemented well before the standard was
> ratified.
>
> C-style cast are *not* deprecated.

But I really thought so. I mean will C++0x still support them ?
I was sure to have read that somewhere, but if you say that they aren't.
They aren't.

>
> You can use "typename" instead of "class" when declaring a template
> argument, but you don't have to and not everyone recommend that usage.

I will modify that.

>
> A list (and very brief discussion) of the changes to C++ *before*
> the standard can be found on my homepages as Appendix B of TC++PL3:
> http://www.research.att.com/~bs/3rd.html

Thanks for the information.

>
> > The link is
> >
> >
http://members.nbci.com/pjmlp/compilers/tutorials/discovering_cxx/discoverin
g_cxx.html
> >
> > Thanks in advance
>
> - Bjarne
> Bjarne Stroustrup - http://www.research.att.com/~bs


 Thanks for your interest

--
Paulo Pinto, uRD Software Engineer
Altitude Software (formerly Easyphone)

paulo.pinto@altitudesoftware.com
www.altitudesoftware.com

The opinions expressed by myself are personal and not of my employer.
Programming languages teach you not to want what they cannot provide.


---
[ 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: remove.haberg@matematik.su.se (Hans Aberg)
Date: Tue, 15 May 2001 11:21:36 GMT
Raw View
In article <u8BeTbB$h$$6Ew+S@ntlworld.com>, Francis Glassborow
<francisG@robinton.demon.co.uk> wrote:
>Another feature here is that, IIRC, the two forms of the C headers have
>a subtle difference, the C form provides the names in the global
>namespace while the C++ form provides them in std.

Both headers put the names in the "std" namespace, but the C headers adds
the "using namespace std" directive. On my compiler this works so that one
alters the name lookup paths; conflicting names can still be resolved by
writing out the full name. So they are not put into the global namespace
by the "using" directive.

  Hans Aberg      * Anti-spam: remove "remove." from email address.
                  * Email: Hans Aberg <remove.haberg@member.ams.org>
                  * Home Page: <http://www.matematik.su.se/~haberg/>
                  * AMS member listing: <http://www.ams.org/cml/>

---
[ 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: "Paulo Pinto" <paulo.pinto@altitudesoftware.com>
Date: Tue, 15 May 2001 11:23:49 GMT
Raw View
"Francis Glassborow" <francis.glassborow@ntlworld.com> wrote in message
news:u8BeTbB$h$$6Ew+S@ntlworld.com...
> In article <XYRL6.109$UB2.2847@nreader1.kpnqwest.net>, Paulo Pinto
> <paulo.pinto@altitudesoftware.com> writes
> >The problem is that the mailer broke the link, please copy the
> >full link to the url window.
>
> OK, pity you had to post the full URL without any wildcards.
>
> Having had a quick look, I think you might need to revisit much of what
> you write. Let me give you a few examples:
>
> The reason for changing the names for the standard headers is exactly
> that previously there was no standard. Some compilers used .h, some used
> .hxx, some .hpp etc. The only fair way was to invalidate all of them and
> at the same time remind programmers that standard headers are not files,
> they just unlock specific parts of the library namespace (yes, most
> implementations provide this feature by mapping standard headers to
> files, but they are not required to do so)

Ok, need to rewrite that section.
I remember having read something about it in C++ Report, now gone :(

>
> Another feature here is that, IIRC, the two forms of the C headers have
> a subtle difference, the C form provides the names in the global
> namespace while the C++ form provides them in std.

I will investigate this

>
> I disagree with the statement you make about typename. In the context of
> template parameter lists, typename and class are fully interchangeable
> and are likely to remain so for the foreseeable future. Some programmers
> prefer one, some the other and some like to use typename when built-in
> types work and class when they do not (as a way of documenting this to
> users). There is no should about using typename in this context.

You're right, I need to correct it. typename should only be used
in contexts were we need to help the compiler.

> You touch on such arcane things as member templates (should not be used
> by those who are not bang up to date with their C++) while ignoring the
> myriad of little changes that may even be silent (i.e. will not trigger
> a diagnostic)

>
> The semantics of the conditional operator have been changed from those
> in the ARM

Right, correct me if I am wrong but now the expression

 a ? b : c + 1

will be evaluated as

 a ? b : (c + 1)

where according to the ARM it will be evaluated as

(a ? b : c) + 1

>
> You are now allowed to delete a const pointer even when it is passed as
> an argument to a function. I think this is right, but it could come as a
> nasty shock to someone who did not expect it.

Ooops, I didnt know about this.

>
> But much more important is that good C++ style has changed radically. No
> simple summary can cover that. Little things like how you write an
> assignment operator. Or big things like writing exception safe code.

I know and this is a big change to the way most people learn to
use C++.


> I know that you are well intentioned, but actually documenting all those
> things that have changed since the earlier days is complicated. In one
> way little has changed, there have been a cluster of new keywords, a few
> major introductions (templates, exceptions and namespaces) but that is
> it. OTOH everything has changed because the way C++ is written has been
> changed by those introductions and by the accumulated wisdom of the
> serious C++ community.
>
> Unfortunately, the people you really need to communicate with think they
> know already. Those that read a book or two a year (selecting carefully)
> or subscribe to at least one quality magazine (not much choice these
> days, either get CUJ, or join ACCU -- now you can all yell about how you
> know about other well informed C++ publications) or subscribe to
> comp.lang.c++.moderated already know that C++ usage is maturing. Those
> that do not will read your page and probably fail to realise that they
> need to work much harder to come up to date. Fortunately most of them
> will eventually give up, claim C++ is always changing and move to Java
> (which is always changing, you know that when writing about language
> problems, C++ authors tell you how to avoid them, while Java ones tell
> you to learn to live with them:)
>
>
>
> Francis Glassborow      ACCU
> 64 Southfield Rd
> Oxford OX4 1PA          +44(0)1865 246490
> All opinions are mine and do not represent those of any organisation
>


I know what you mean. I realize that most people will look at
the page and drift away to more pleasant places. But I needed to
create a page for my work colleagues and decided to allow everyone
else to read it. Maybe some of the people that read the page will
decide to investigate how much C++ is different from when they learned
it and learn more about it.

You talk about people leaving C++. I know what that is. In Portugal
most people learn C++ in the university in their 1st, or 2nd year, in
introductory classes. A C++ that falls under the kind of usage that
C++ had around 1996. I was a monitor for C++ classes in my last university
year, back in 1999, and taught for the first time templates!
What happens is that most classes in the university require the students
to create their projects in C, and now Java. So the students only know
C++ as they used to in that introductory classes. That's the ones I want
to target. To say to them, "Look, C++ has suffered many changes. Here
are some of them", and maybe that will make them go out and update their
C++ knowledge.

---
[ 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: "Paulo Pinto" <paulo.pinto@altitudesoftware.com>
Date: Mon, 14 May 2001 13:37:06 GMT
Raw View
 Hello,

 I've assembled a FAQ with a small set of changes that
have happened to C++ since the standard process has
ended. My ideia is that it helps people that aren't
well aware of has happened to their favorite language :)

 So I invite you to come to the site and tell me what
do you think of it. What information is incorrect, what
should be corrected. Whatever.

The link is

http://members.nbci.com/pjmlp/compilers/tutorials/discovering_cxx/discoverin
g_cxx.html

Thanks in advance

--
Paulo Pinto, uRD Software Engineer
Altitude Software (formerly Easyphone)

paulo.pinto@altitudesoftware.com
www.altitudesoftware.com

The opinions expressed by myself are personal and not of my employer.
Programming languages teach you not to want what they cannot provide.


---
[ 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: Mon, 14 May 2001 14:18:40 GMT
Raw View
In article <E2RL6.149$dP4.2511@nreader2.kpnqwest.net>, Paulo Pinto
<paulo.pinto@altitudesoftware.com> writes
> Hello,
>
> I've assembled a FAQ with a small set of changes that
>have happened to C++ since the standard process has
>ended.

Do you mean literally that? Because the only changes that have happened
to Standard C++ are yet to happen:) They only come into effect when the
Technical Corrigendum is published.

>My ideia is that it helps people that aren't
>well aware of has happened to their favorite language :)

Most people have problems with the things that happened to C++ after the
time their teacher (book author or course instructor) last updated their
knowledge.

>
> So I invite you to come to the site and tell me what
>do you think of it. What information is incorrect, what
>should be corrected. Whatever.

Difficult, because I just got a 'members page does not exist' response.

>
>The link is
>
>http://members.nbci.com/pjmlp/compilers/tutorials/discovering_cxx/discoverin
>g_cxx.html
>
>Thanks in advance

Francis Glassborow      ACCU
64 Southfield Rd
Oxford OX4 1PA          +44(0)1865 246490
All opinions are mine and do not represent those of any organisation


======================================= MODERATOR'S COMMENT:
 I checked the link before approving; the URL is linewrapped and must be rejoined.

---
[ 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: "Paulo Pinto" <paulo.pinto@altitudesoftware.com>
Date: Mon, 14 May 2001 14:39:01 GMT
Raw View
"Francis Glassborow" <francis.glassborow@ntlworld.com> wrote in message
news:MNnG$uAke+$6EwIg@ntlworld.com...
> In article <E2RL6.149$dP4.2511@nreader2.kpnqwest.net>, Paulo Pinto
> <paulo.pinto@altitudesoftware.com> writes
> > Hello,
> >
> > I've assembled a FAQ with a small set of changes that
> >have happened to C++ since the standard process has
> >ended.
>
> Do you mean literally that? Because the only changes that have happened
> to Standard C++ are yet to happen:) They only come into effect when the
> Technical Corrigendum is published.
>
> >My ideia is that it helps people that aren't
> >well aware of has happened to their favorite language :)
>
> Most people have problems with the things that happened to C++ after the
> time their teacher (book author or course instructor) last updated their
> knowledge.
>


That's really what I mean. I have many friends that know C++ as it was
when they were at the university.


> >
> > So I invite you to come to the site and tell me what
> >do you think of it. What information is incorrect, what
> >should be corrected. Whatever.
>
> Difficult, because I just got a 'members page does not exist' response.

The problem is that the mailer broke the link, please copy the
full link to the url window.

>
> >
> >The link is
> >
>
>http://members.nbci.com/pjmlp/compilers/tutorials/discovering_cxx/discoveri
n
> >g_cxx.html
> >
> >Thanks in advance
>
> Francis Glassborow      ACCU
> 64 Southfield Rd
> Oxford OX4 1PA          +44(0)1865 246490
> All opinions are mine and do not represent those of any organisation
>
>
> ======================================= MODERATOR'S COMMENT:
>  I checked the link before approving; the URL is linewrapped and must be
rejoined.
>
> ---
> [ 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                ]
>

---
[ 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                ]