Re: how to recognize whether code is C or C++?
On May 21, 7:39 pm, Noah Roberts <n...@nowhere.com> wrote:
Jeff Schwab wrote:
In the third place, if you really just want to be
consistent, the thing to change is the forward declaration,
not the definition. The following two declarations are
semantically identical:
class base;
struct base;
They may seem the same, and should be the same, but at least
one compiler has alway rejected it if it doesn't match the
actual definition.
The only compiler I know which rejected it hasn't been around
for seven or eight years. All of the current versions I have
access to accept it.
In the fourth place, forward declarations smell bad.
There's rarely any good reason to start declaring code to
work with classes whose definitions have not even been seen.
Oh really? Guess Sutter shouldn't have recommended them on
his GotD site and his Exceptional C++ books.
Actually, Sutter isn't alone here---he's basing his
recommendations on Lakos. For once, every expert I know seems
to be in agreement here.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34