A
Aaron Anodide
I ran into a wierd problem today where a case of circular includes caused my
build to completely break. All my classes are spit out by a class wizard
with "#pragma once" in the header. I thought this was equiv with the
standard #ifndef scheme.
Anyway, instead of figuring out exactly what went wrong (because after an
hour all I can come up with is there was a cycle), I decided to use forward
declarations, so everywhere I used to have:
#include "Foo.h"
I now have:
class cFoo;
My question is: is this a standard practice, to use forward declarations
instead of #include? It seems more efficient to me, unless you are callling
a method of the class of course, but that's only when you inline something
right in the header.
- Aaron Anodide
build to completely break. All my classes are spit out by a class wizard
with "#pragma once" in the header. I thought this was equiv with the
standard #ifndef scheme.
Anyway, instead of figuring out exactly what went wrong (because after an
hour all I can come up with is there was a cycle), I decided to use forward
declarations, so everywhere I used to have:
#include "Foo.h"
I now have:
class cFoo;
My question is: is this a standard practice, to use forward declarations
instead of #include? It seems more efficient to me, unless you are callling
a method of the class of course, but that's only when you inline something
right in the header.
- Aaron Anodide