Runtime exception check at compile time?
Eljay Love-Jensen
eljay@adobe.com
Wed Sep 14 20:20:00 GMT 2005
Hi Matt,
> I've painfully discovered that all exceptions in c++ functions must be
declared if they are thrown.
What do you mean? Like this...
class Foo;
int Func()
{
throw Foo();
}
Yes, you need to declare Foo. A forward declaration is insufficient.
> Can the compiler enforce this at compile time instead of at runtime?
GCC's g++ compiler/linker disallows the above, for me.
--Eljay
More information about the Gcc-help
mailing list