In C++, one does ? for circular dependencies?

Discussion of chess software programming and technical issues.

Moderator: Ras

mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: In C++, one does ? for circular dependencies?

Post by mcostalba »

Desperado wrote:
Does anybody disagree ? (Hope not :-) )

I agree :-)

Thanks everybody for the clarification :-)

Marco
User avatar
Bo Persson
Posts: 262
Joined: Sat Mar 11, 2006 8:31 am
Location: Malmö, Sweden
Full name: Bo Persson

Re: In C++, one does ? for circular dependencies?

Post by Bo Persson »

Desperado wrote:Funny (a little bit) the thread here :-).

We are back to the roots :-)

But talking about such basics i would like to add my statement once
again:

For me:

- a Declaration (doesnt matter c / c++ elsewhere) just
lets the compiler know that there is existing something(a type,class whatever).if this content is given it is a declaration. Sometimes it is two in one a Declaration and the next, a Definition.

- a Definition for me is when you let the compiler know how the type/class
looks like.(so this can(must not) be done with a declaration).

- and then of course the instances... (without comment)

So, for me doesnt exist a so called "Forward Declaration". The only thing
to differ if declartion and definition is a "2 in 1 statement" or both of them are seperate instructions (if you want to call this "seperate" -> "Forward Declaration" thats ok, but doesnt change the contents, and because it doesnt change the contents you can simple call it "declaration").
(Also the word declaration (in my eyes) cant be done twice. if it declared it's declared, or not ?)

Does anybody disagree ? (Hope not :-) )
You are right, a definition also serves as a declaration, if there hasn't been one earlier. The name is introduced AND its meaning is defined at once.

The phrase forward declaration comes from other languages, like Pascal that has a keyword FORWARD for this purpose. It's of course ok to use that phrase for C++ code as well, even though 'declaration' means the same thing.