Re: Can Class be Inter-refferenced?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"Mark Randall" <markyr@xxxxxxxxxxxxxx> wrote in message
news:%23DjSyoYBHHA.1196@xxxxxxxxxxxxxxxxxxxxxxx
"David Wilkinson" <no-reply@xxxxxxxxxxxx> wrote in message news:%
Gotta say, when I saw Will's code I thought it was wrong also, but when I
checked it I found that it worked! I'm so used to using forward
declaration with pointers or references, I guess.

I took another look at the issue.

Someone who knows the C++ standard would have to check, but I figured this
is because when the function is called the size of ClassB must be known
anyway (ClassB included in the cpp file) or else compilation would fail
with an incomplete type.

I think passing an incomplete type would only be a problem
with std templates. I'm not sure what the standard
says about this. It doesn't usually come up for
me as passing the object as a const & is generally preferred.


.



Relevant Pages

  • Re: Sun f90 bad optimization for assumed-shape array
    ... Nothing in the standard ... the old FORTRAN 77 way of passing an array was to ... just pass the base address, not a dope vector, because ... I sort of meant that F77 compilers ...
    (comp.lang.fortran)
  • Re: how to use %val() ???
    ... Does this mean that passing by reference is in the standard? ... It all comes down to what passing by reference means. ... Actually the memory "pointed" to by C pointers can be passed by copy-in/copy-out, ... A compiler will make something work in any particular circumstance. ...
    (comp.lang.fortran)
  • Re: void vs void* (philosophical question)
    ... incomplete type that cannot be completed and comprises the empty set of ... In a larger, "not Standard C" sense, yes. ... I might also remove the "flexible array member" and simply bless the ... Reading email is like searching for food in the garbage, ...
    (comp.lang.c)
  • Re: max size for printf() format conversion?
    ... > I suppose it's undefined behavior in the sense that the standard ... > doesn't guarantee that it will work. ... passing a null pointer to strlenreturns 0, ...
    (comp.lang.c)
  • Re: call by address vs. call by value
    ... >> standard does not define anything about what is faster than what. ... >was merely mimicked by passing the value of a pointer to an object. ... name" (or reference, or pointer...although using "reference" can be ...
    (comp.lang.c)