Topic: a question
Author: "Arthur J. O'Dwyer" <ajo@andrew.cmu.edu>
Date: Thu, 23 Jan 2003 11:00:40 -0500 (EST) Raw View
On Wed, 22 Jan 2003, "Rodolfo Frino" wrote:
>
> > I didn't say you were wrong, but it would be not sufficiently correct
> > to just say "C++ is an object-oriented language." I have heard that
> > real OO languages enforce the OO way, but C++ doesn't. In this regard,
> > I would say "C++ supports OO" but not "C++ is an OO language."
> > Suppose someone writes in a generic programming style:
> > is he fiddling with an OO language in a wrong way? ;-)
>
> No. C++ has the flexibility of being able to be used in a non OO way,
> but the langage itself is still OO. It's like an amphibious car, it is
> amphibious at all times, even if you only drive it on the street.
>
> Rodolfo
By that argument, C is "object-oriented" because you can implement
OO programs in C (modularization, data hiding, whatever else you
want). Even a Turing machine would be "OO", because anything that
can be implemented in C++ can be implemented on a Turing machine.
I would not call C++ an "object-oriented language", because while
you can write object-oriented programs in C++, the language does not
enforce that paradigm, in the same way that C++ is not a "functional
language" even though you can write functional-paradigm programs in
C++.
C++ often _allows_ elegant OO solutions, but it is _not_ an OO
language. Just like an amphibian is not a land animal, even though
it may often be seen on land.
-Arthur
Author: musiphil@bawi.org (KIM Seungbeom)
Date: Wed, 22 Jan 2003 07:06:58 +0000 (UTC) Raw View
Rodolfo Frino wrote:
> "KIM Seungbeom" <musiphil@bawi.org> wrote in message
> news:3E2BB2F9.9D9F5FBE@bawi.org...
> > Rodolfo Frino wrote:
> > >
> > > 1- C++ is an object oriented language.
> > > (C++ has classes, objects, inheritance, polimorphism, operator overloading, etc.)
> >
> > Bjarne Stroustrup mentions in his FAQ that C++ is a multi-paradigm
> > programming language. He even wrote an article titled "Why C++ isn't
> > just an Object-Oriented Programming Language".. :)
> > http://www.research.att.com/~bs/bs_faq.html#Object-Oriented-language
> > http://www.research.att.com/~bs/oopsla.pdf
>
> That doesn't contradict my statement
>
> If you read carefully what Bjarne Stroustrup wrote:
> "...C++ isn't just an Object-Oriented Programming Language"
>
> You will see that it means:
> "...C++ is not only an Object-Oriented Programming Language but also..."
I didn't say you were wrong, but it would be not sufficiently correct
to just say "C++ is an object-oriented language." I have heard that
real OO languages enforce the OO way, but C++ doesn't. In this regard,
I would say "C++ supports OO" but not "C++ is an OO language."
Suppose someone writes in a generic programming style:
is he fiddling with an OO language in a wrong way? ;-)
--
KIM Seungbeom <musiphil@bawi.org>
---
[ 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.jamesd.demon.co.uk/csc/faq.html ]
Author: llewelly.@@xmission.dot.com (llewelly)
Date: Wed, 22 Jan 2003 07:08:53 +0000 (UTC) Raw View
rodolfofrino@dodo.com.au ("Rodolfo Frino") writes:
> > >1- C++ is an object oriented language.
> >
> > Actually, it isn't; it is a language that supports the object-oriented
> > and generic paradigms in addition to the procedural one. Smalltalk is an
> > OO language.
>
> Actually it is, according to Cardelli and Wegner's definition:
You are missing some context. There is a vocal segment of the OO
programming community that has an artificially narrow definition
of OO. Claims such as "multiple inheritance is not OO', 'Real OO
languages have gc', 'Real OO languages don't have pointers',
'C++'s builtin types aren't really objects, so C++ isn't really
OO.' 'OO is the One True Way, so any language that has non-OO
features is 3v1l' etc.
The statement that C++ isn't an object oriented language is a natural
response to such artificially limited definitions of OO.
Of course responsible computer scientists like Cardelli and Wegner do
not place such ridiculous limitations on their definition of OO,
and so the claim that C++ is not object oriented seems non-sensical
when mis-applied to the Cardelli and Wegner definition.
>
> "a language is object-oriented if and only if satisfies the following
> requirements
>
> - It supports objects that are data abstractions with an interface of name
> operations
> and a hidden local state
>
> - Objects have an associated type [class]
>
> - Types [classes] may inherit attributes from supertypes [superclasses]"
>
> under this definition both C++ and Smalltalk are OO languages.
>
> If you have a different definition, please refrain from saying that
> something "it isn't",
> since all is a matter of definition, and you have not provided one.
[snip]
No. However, I find that Cardelli and Wegner definition is *not* a
widely used definition of OO - it is only used by people who
are both (a) trying to be precise, and (b) familiar with the
literature.
---
[ 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.jamesd.demon.co.uk/csc/faq.html ]
Author: kanze@gabi-soft.de (James Kanze)
Date: Wed, 22 Jan 2003 18:05:58 +0000 (UTC) Raw View
francis.glassborow@ntlworld.com (Francis Glassborow) wrote in message
news:<RboFAcDr+XL+EwqV@robinton.demon.co.uk>...
> In article <3e2d573c@news.comindico.com.au>, Rodolfo Frino
> <rodolfofrino@dodo.com.au> writes
> >> >1- C++ is an object oriented language.
> >> Actually, it isn't; it is a language that supports the
> >> object-oriented and generic paradigms in addition to the procedural
> >> one. Smalltalk is an OO language.
> >Actually it is, according to Cardelli and Wegner's definition:
> >"a language is object-oriented if and only if satisfies the following
> >requirements
> >- It supports objects that are data abstractions with an interface of name
> >operations
> >and a hidden local state
> >- Objects have an associated type [class]
> >- Types [classes] may inherit attributes from supertypes [superclasses]"
> >under this definition both C++ and Smalltalk are OO languages.
> Yes, they are allowed to define OO any way they like, and others are
> allowed to provide different definitions.
The difference being, of course, that Cardelli and Wegner are pretty
much THE reference in this regard.
Others do provide different definitions. According to one definition I
read by Bernard Eiffel, C++ certainly isn't an object oriented language.
Neither is Smalltalk. Nor Java. In fact, the only object oriented
language is Eiffel. Java fans, of course, provide a different
definition; one which typically excludes C++ (but not necessarily
Smalltalk). But one might argue that such definitions are "motivated";
they aren't impartial, and aren't shared by the community of people who
are concerned with such questions.
C++ supports multiple inheritance. C++ isA object oriented language.
C++ isA procedural language. C++ isA generic programming language.
About the only proposition I'd have trouble with would be C++ isA
functional language, and even there, you can do a lot of function style
programming in C++.
--
James Kanze mailto:jkanze@caicheuvreux.com
Conseils en informatique orient e objet/
Beratung in objektorientierter Datenverarbeitung
---
[ 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.jamesd.demon.co.uk/csc/faq.html ]
Author: rodolfofrino@dodo.com.au ("Rodolfo Frino")
Date: Wed, 22 Jan 2003 20:55:40 +0000 (UTC) Raw View
> I didn't say you were wrong, but it would be not sufficiently correct
> to just say "C++ is an object-oriented language." I have heard that
> real OO languages enforce the OO way, but C++ doesn't. In this regard,
> I would say "C++ supports OO" but not "C++ is an OO language."
> Suppose someone writes in a generic programming style:
> is he fiddling with an OO language in a wrong way? ;-)
No. C++ has the flexibility of being able to be used in a non OO way,
but the langage itself is still OO. It's like an anfibious car, it is
anfibiuos
at all times, even if you only drive it on the street.
Rodolfo
StarGate Publishing
http://members.dodo.net.au/~rodolfofrino/_Journal.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.jamesd.demon.co.uk/csc/faq.html ]
Author: rodolfofrino@dodo.com.au ("Rodolfo Frino")
Date: Mon, 20 Jan 2003 05:31:40 +0000 (UTC) Raw View
It would take too long to summarise all the differences between C and C++,
but the major differences are:
1- C++ is an object oriented language.
(C++ has classes, objects, inheritance, polimorphism, operator
overloading, etc.)
2- In C++ Dynamic Memory allocation/deallocation can be done via the new
and delete keywords.
3- C++ has a very powerful and advanced "programming tool" called the STL
(Standard Template Library)
4- C++ has the bool data type.
Hope it helps
Rodolfo
StarGate Publishing
http://members.dodo.net.au/~rodolfofrino/_Journal.html
"Sitara" <sitarafalik@hotmail.com> wrote in message
news:68a6e0d8.0301152157.72895dc9@posting.google.com...
> what is the basic difference between c language and c++ ?
>
> i know that c++ is an advanced version of c, but when we talk about
> the programming concepts, is there any difference.
>
> ---
> [ 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.jamesd.demon.co.uk/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.jamesd.demon.co.uk/csc/faq.html ]
Author: musiphil@bawi.org (KIM Seungbeom)
Date: Mon, 20 Jan 2003 10:59:41 +0000 (UTC) Raw View
Rodolfo Frino wrote:
>
> It would take too long to summarise all the differences between C and C++,
> but the major differences are:
>
> 1- C++ is an object oriented language.
> (C++ has classes, objects, inheritance, polimorphism, operator overloading, etc.)
Bjarne Stroustrup mentions in his FAQ that C++ is a multi-paradigm
programming language. He even wrote an article titled "Why C++ isn't
just an Object-Oriented Programming Language".. :)
http://www.research.att.com/~bs/bs_faq.html#Object-Oriented-language
http://www.research.att.com/~bs/oopsla.pdf
--
KIM Seungbeom <musiphil@bawi.org>
---
[ 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.jamesd.demon.co.uk/csc/faq.html ]
Author: francis.glassborow@ntlworld.com (Francis Glassborow)
Date: Mon, 20 Jan 2003 11:00:36 +0000 (UTC) Raw View
In article <3e2b88da@news.comindico.com.au>, Rodolfo Frino
<rodolfofrino@dodo.com.au> writes
>It would take too long to summarise all the differences between C and C++,
>but the major differences are:
>
>1- C++ is an object oriented language.
Actually, it isn't; it is a language that supports the object-oriented
and generic paradigms in addition to the procedural one. Smalltalk is an
OO language.
> (C++ has classes, objects, inheritance, polimorphism, operator
>overloading, etc.)
>2- In C++ Dynamic Memory allocation/deallocation can be done via the new
> and delete keywords.
Not actually, operators new and delete handle dynamic memory. The new
and delete keywords are important because they provide the tools for
construction and destruction of dynamic objects including managing their
base memory in the way determined by the programmer.
>3- C++ has a very powerful and advanced "programming tool" called the STL
> (Standard Template Library)
That is just a library. Its form is a consequence of the language's
capabilities.
>4- C++ has the bool data type.
So does C, only the fundamental type's name is spelt _Bool.
Of course I agree that C++ is a much more powerful language than C but
understanding that is more complicated than just presenting a few sound
bites.
--
ACCU Spring Conference 2003 April 2-5
The Conference you cannot afford to miss
Check the details: http://www.accuconference.co.uk/
Francis Glassborow ACCU
---
[ 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.jamesd.demon.co.uk/csc/faq.html ]
Author: rodolfofrino@dodo.com.au ("Rodolfo Frino")
Date: Tue, 21 Jan 2003 16:26:36 +0000 (UTC) Raw View
> >1- C++ is an object oriented language.
>
> Actually, it isn't; it is a language that supports the object-oriented
> and generic paradigms in addition to the procedural one. Smalltalk is an
> OO language.
Actually it is, according to Cardelli and Wegner's definition:
"a language is object-oriented if and only if satisfies the following
requirements
- It supports objects that are data abstractions with an interface of name
operations
and a hidden local state
- Objects have an associated type [class]
- Types [classes] may inherit attributes from supertypes [superclasses]"
under this definition both C++ and Smalltalk are OO languages.
If you have a different definition, please refrain from saying that
something "it isn't",
since all is a matter of definition, and you have not provided one.
Rodolfo
---
[ 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.jamesd.demon.co.uk/csc/faq.html ]
Author: francis.glassborow@ntlworld.com (Francis Glassborow)
Date: Tue, 21 Jan 2003 17:16:09 +0000 (UTC) Raw View
In article <3e2d573c@news.comindico.com.au>, Rodolfo Frino
<rodolfofrino@dodo.com.au> writes
>> >1- C++ is an object oriented language.
>>
>> Actually, it isn't; it is a language that supports the object-oriented
>> and generic paradigms in addition to the procedural one. Smalltalk is an
>> OO language.
>
>Actually it is, according to Cardelli and Wegner's definition:
>
>"a language is object-oriented if and only if satisfies the following
>requirements
>
>- It supports objects that are data abstractions with an interface of name
>operations
>and a hidden local state
>
>- Objects have an associated type [class]
>
>- Types [classes] may inherit attributes from supertypes [superclasses]"
>
>under this definition both C++ and Smalltalk are OO languages.
Yes, they are allowed to define OO any way they like, and others are
allowed to provide different definitions. In this case the main
disagreement would be with the first requirement. Some, Bjarne
Stroustrup I believe among them, require a stricter requirement. Note
that you made your original assertion that I was disagreeing with, by
simply appending a list of C++ features. That does not constitute a
consensus on what an OO language is, though it goes some way toward what
OO programming tools are.
--
ACCU Spring Conference 2003 April 2-5
The Conference you cannot afford to miss
Check the details: http://www.accuconference.co.uk/
Francis Glassborow ACCU
---
[ 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.jamesd.demon.co.uk/csc/faq.html ]
Author: rodolfofrino@dodo.com.au ("Rodolfo Frino")
Date: Tue, 21 Jan 2003 19:05:58 +0000 (UTC) Raw View
That doesn't contradict my statement
If you read carefully what Bjarne Stroustrup wrote:
"...C++ isn't just an Object-Oriented Programming Language"
You will see that it means:
"...C++ is not only an Object-Oriented Programming Language but also..."
Rodolfo
"KIM Seungbeom" <musiphil@bawi.org> wrote in message
news:3E2BB2F9.9D9F5FBE@bawi.org...
> Rodolfo Frino wrote:
> >
> > It would take too long to summarise all the differences between C and
C++,
> > but the major differences are:
> >
> > 1- C++ is an object oriented language.
> > (C++ has classes, objects, inheritance, polimorphism, operator
overloading, etc.)
>
> Bjarne Stroustrup mentions in his FAQ that C++ is a multi-paradigm
> programming language. He even wrote an article titled "Why C++ isn't
> just an Object-Oriented Programming Language".. :)
> http://www.research.att.com/~bs/bs_faq.html#Object-Oriented-language
> http://www.research.att.com/~bs/oopsla.pdf
>
> --
> KIM Seungbeom <musiphil@bawi.org>
>
> ---
> [ 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.jamesd.demon.co.uk/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.jamesd.demon.co.uk/csc/faq.html ]
Author: rodolfofrino@dodo.com.au ("Rodolfo Frino")
Date: Tue, 21 Jan 2003 19:06:31 +0000 (UTC) Raw View
> >It would take too long to summarise all the differences between C and
C++,
> >but the major differences are:
> >
> >1- C++ is an object oriented language.
>
> Actually, it isn't; it is a language that supports the object-oriented
> and generic paradigms in addition to the procedural one. Smalltalk is an
> OO language.
Why not? How do you define an OO language?
> >2- In C++ Dynamic Memory allocation/deallocation can be done via the new
> > and delete keywords.
>
> Not actually, operators new and delete handle dynamic memory.
What do you mean by : "not actually."
Do you mean that the new and delete operators do not allocate and deallocate
heap
memory respectively?
> >3- C++ has a very powerful and advanced "programming tool" called the STL
> > (Standard Template Library)
>
> That is just a library. Its form is a consequence of the language's
> capabilities.
And so what? It's a library that many other programming languages don't
have.
And C hasn't got it.
> >4- C++ has the bool data type.
>
> So does C, only the fundamental type's name is spelt _Bool.
I was referring to pre-1999 C language, this is before the addition.
But you are right.
Rodolfo
---
[ 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.jamesd.demon.co.uk/csc/faq.html ]
Author: francis.glassborow@ntlworld.com (Francis Glassborow)
Date: Tue, 21 Jan 2003 23:54:54 +0000 (UTC) Raw View
In article <3e2d5335@news.comindico.com.au>, Rodolfo Frino
<rodolfofrino@dodo.com.au> writes
>What do you mean by : "not actually."
>Do you mean that the new and delete operators do not allocate and deallocate
>heap
>memory respectively?
No I mean that the keyword refers to the new and delete expressions. It
was one of the poorer C++ design decisions IMHO to make the
allocation/deallocation functions overload the meaning of the keywords.
--
ACCU Spring Conference 2003 April 2-5
The Conference you cannot afford to miss
Check the details: http://www.accuconference.co.uk/
Francis Glassborow ACCU
---
[ 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.jamesd.demon.co.uk/csc/faq.html ]
Author: kuyper@wizard.net ("James Kuyper Jr.")
Date: Fri, 17 Jan 2003 06:59:29 +0000 (UTC) Raw View
Sitara wrote:
> what is the basic difference between c language and c++ ?
>
> i know that c++ is an advanced version of c, but when we talk about
> the programming concepts, is there any difference.
Well written C code is also almost always valid C++ code, with almost
exactly the same meaning. However, well written C++ code usually makes
heavy use of many different features that C++ has, and that C doesn't.
The C++ standard is 776 pages long, and I'd estimate that the parts that
describe differences from C add up to at least 500 pages.
Currently, C99 has a few new features that C++ doesn't. Most of them are
likely to be added to the next version of C++, but not necessarily all
of them. C and C++ are two different languages, and they're heading off
in different directions.
---
[ 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.jamesd.demon.co.uk/csc/faq.html ]
Author: francis.glassborow@ntlworld.com (Francis Glassborow)
Date: Fri, 17 Jan 2003 17:04:07 +0000 (UTC) Raw View
In article <68a6e0d8.0301152157.72895dc9@posting.google.com>, Sitara
<sitarafalik@hotmail.com> writes
>what is the basic difference between c language and c++ ?
>
>i know that c++ is an advanced version of c, but when we talk about
>the programming concepts, is there any difference.
It does not make very much sense to talk about object orientation in C
(yes you can do it, but only by very hard work). Generic and
metaprogramming are effectively impossible in C.
Those that know me know that I very much advocate that C has a place in
the world of Software so do not get me wrong when I say that C is to C++
much as a circa 1980's pocket calculator is to a modern palmtop.
--
ACCU Spring Conference 2003 April 2-5
The Conference you cannot afford to miss
Check the details: http://www.accuconference.co.uk/
Francis Glassborow ACCU
---
[ 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.jamesd.demon.co.uk/csc/faq.html ]
Author: Ken@Alverson.net ("Ken Alverson")
Date: Fri, 17 Jan 2003 17:28:44 +0000 (UTC) Raw View
"Sitara" <sitarafalik@hotmail.com> wrote in message
news:68a6e0d8.0301152157.72895dc9@posting.google.com...
> what is the basic difference between c language and c++ ?
>
> i know that c++ is an advanced version of c, but when we talk about
> the programming concepts, is there any difference.
If you treat C++ as an advanced version of C, you'll come away feeling
like C++ is a bloated, unnecessary language that tries to do everything.
If you treat C++ as a different language, and take the time to learn the
C++ idioms and standard library, you'll find that it's very different,
and in many people's opinions, much more effective in a wide variety of
uses.
Ken
---
[ 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.jamesd.demon.co.uk/csc/faq.html ]
Author: sitarafalik@hotmail.com (Sitara)
Date: Fri, 17 Jan 2003 00:26:42 +0000 (UTC) Raw View
what is the basic difference between c language and c++ ?
i know that c++ is an advanced version of c, but when we talk about
the programming concepts, is there any difference.
---
[ 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.jamesd.demon.co.uk/csc/faq.html ]
Author: fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON)
Date: Mon, 8 Feb 1993 06:56:47 GMT Raw View
bs@alice.att.com (Bjarne Stroustrup) writes:
>hxie@eniac.seas.upenn.edu (Hong-liang Xie @ University of Pennsylvania) writes
>
> > I am a novice of C++. The following program cannot pass compiling (g++).
> > Any comments are appreciated. Thank you very much.
> >
>You hit a compiler bug. The example is ok. Get a new compiler or work around
>the problem.
> > class A {
> > int a;
> > public:
> > static int *list; /* when I remove static, I can pass compiling, otherwise
> > * I cannot. */
According to ARM 9.4, "The declaration of a static data member in its class
definition is *not* a definition. A definition is required elsewhere;
see also 18.3". According to ARM 18.3, allowing the definition to be omitted
(with initialization defaulting to all zeroes) is an anachronism, and
"A C++ implementation is not obliged to provide these features [the
anachronisms".
Thus I would conclude that it is *not* a compiler bug, and the example is
not OK. The original poster needs to add the following line to his code:
static int *A::list;
I am appending the relevant section from the g++/libg++ FAQ.
The g++ FAQ is highly recommended reading for g++ users!
|| Linker reports undefined symbols for static data members
|| ========================================================
||
|| "g++ reports undefined symbols for all my static data members when
|| I link, even though the program works correctly for compiler XYZ.
|| What's going on?"
||
|| The problem is almost certainly that you don't give definitions for
|| your static data members. If you have
||
|| class Foo {
|| ...
|| void method();
|| static int bar;
|| };
||
|| you have only declared that there is an int named Foo::bar and a
|| member function named Foo::method that is defined somewhere. You
|| still need to defined BOTH method() and bar in some source file.
|| According to the draft ANSI standard, you must supply an initializer,
|| such as
||
|| int Foo::bar = 0;
||
|| in one (and only one) source file.
--
Fergus Henderson fjh@munta.cs.mu.OZ.AU
This .signature virus is a self-referential statement that is true - but
you will only be able to consistently believe it if you copy it to your own
.signature file!