Topic: Migrating from C to C++ (a.k.a. "C9X vs C++")
Author: David R Tribble <david@tribble.com>
Date: 1999/10/14 Raw View
Jonathan de Boyne Pollard wrote:
>
> T.E.Dickey wrote:
>> Steve Clamage <clamage@eng.sun.com> wrote:
>> >> Most importantly, you lose a lot of good idiom when trying to
>> >> do that.
>>
>> > Can you provide an example? I don't know of any C idioms that
>> > represent good programming practice that are invalid in C++.
>> > The exception would be use of malloc, as noted above.
>>
>> C++'s notion of the scope of const differs from C's [...]
>
> You mean "linkage", not "scope", surely ?
Both notions of scope and linkage are different in C and C++.
Linkage difference:
const int x = 2; // C++: implicit 'static',
// C: implicit 'extern'
Scope difference:
struct Foo
{
struct Bar // C++: Bar not visible outside Foo except
{ // as Foo::Bar,
... // C: struct Bar visible outside Foo
};
...
};
-- David R. Tribble, david@tribble.com, http://www.david.tribble.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://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: James Kuyper <kuyper@wizard.net>
Date: 1999/10/07 Raw View
"T.E.Dickey" wrote:
>
> In comp.std.c Jonathan de Boyne Pollard <J.deBoynePollard@tesco.net> wrote:
>
> > T.E.Dickey wrote:
> >> C++'s notion of the scope of const differs from C's [...]
>
> > You mean "linkage", not "scope", surely ?
>
> Yes (the technically correct term, though usage makes them near-synonyms --
> some people object to my terminology, but usually not my spelling ;-)
Scope and linkage are very different things. Usage that treats them as
near-synonyms is guaranteed to both reflect and cause misunderstandings.
Read up on them before commenting further.
---
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: "T.E.Dickey" <dickey@clark.net>
Date: 1999/10/07 Raw View
In comp.std.c Nick Maclaren <nmm1@cus.cam.ac.uk> wrote:
> Did you mean to post this to comp.std.c?
I posted it to comp.std.c, as a followup to someone's cross-posting to both
groups (I noticed this week some problem with my ISP's list of moderators,
but haven't had the time to track it down since it's not on a local machine -
will do that on the weekend).
--
Thomas E. Dickey
dickey@clark.net
http://www.clark.net/pub/dickey
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: Jonathan de Boyne Pollard <J.deBoynePollard@tesco.net>
Date: 1999/10/06 Raw View
T.E.Dickey wrote:
> In comp.std.c Steve Clamage <clamage@eng.sun.com> wrote:
> >>Most importantly, you lose a lot of good idiom when trying to
> >>do that.
>
> > Can you provide an example? I don't know of any C idioms that
> > represent good programming practice that are invalid in C++.
> > The exception would be use of malloc, as noted above.
>
> C++'s notion of the scope of const differs from C's [...]
You mean "linkage", not "scope", surely ?
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: nmm1@cus.cam.ac.uk (Nick Maclaren)
Date: 1999/10/07 Raw View
In article <hcPK3.910$N64.24833@dfw-read.news.verio.net>,
T.E.Dickey <dickey@shell.clark.net> wrote:
>In comp.std.c Jonathan de Boyne Pollard <J.deBoynePollard@tesco.net> wrote:
>
>> T.E.Dickey wrote:
>>> C++'s notion of the scope of const differs from C's [...]
>
>> You mean "linkage", not "scope", surely ?
>
>Yes (the technically correct term, though usage makes them near-synonyms --
>some people object to my terminology, but usually not my spelling ;-)
Did you mean to post this to comp.std.c?
Regards,
Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QG, England.
Email: nmm1@cam.ac.uk
Tel.: +44 1223 334761 Fax: +44 1223 334679
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html ]