Why, really, deleting an incomplete type is undefined behaviour?

To combine several answers and add my own, without a class definition the calling code doesn’t know: whether the class has a declared destructor, or if the default destructor is to be used, and if so whether the default destructor is trivial, whether the destructor is accessible to the calling code, what base classes exist … Read more

What is the header?

It’s so you can declare, in your own headers, methods that rely on the declarations of iostream types without having to #include the iostream headers themselves, which are large, complex and slow to compile against. Here’s a simple example: // foo.h #include <iosfwd> void sucker(std::iostream& is);   // foo.cc #include <iostream> void sucker(std::iostream& is) { … Read more

C++ class forward declaration

Use forward declaration when possible. Suppose you want to define a new class B that uses objects of class A. B only uses references or pointers to A. Use forward declaration then you don’t need to include <A.h>. This will in turn speed a little bit the compilation. class A ; class B { private: … Read more

Private Methods in Objective-C, in Xcode 4.3 I no longer need to declare them in my implementation file ?

As of the LLVM Compiler version shipped with Xcode 4.3, if you try to call a method that the compiler has not previously seen, it will look in the rest of the current @implementation block to see if that method has been declared later. If so, then it uses that, and you don’t get a … Read more