If you're not using exceptions, you shouldn't use constructors (or shouldn't write constructors that can fail), because as you've noticed, there is no way to report an error from a constructor except via an exception. You can alternately use a factory function and use that to decouple the bits that can fail from the bits that can't
class myClass {
private:
char *m_malloced_buffer;
// disallow calling ctors/dtors directly
myClass(char *malloced_buffer) : m_malloced_buffer(malloced_buffer) {}
~myClass() { free(m_malloced_buffer); }
public:
static myClass *create()
{
char *buf = static_cast<char*>(malloc(100*sizeof(*mem)));
if(!buf) return NULL;
void *myClassRes = malloc(sizeof(myClass));
if(!myClassRes) return NULL;
new (myClassRes) myClass(buf); // placement new, uses existing memory to invoke the ctor
return static_cast<myClass*>(myClassRes);
}
static void destroy(myClass* val)
{
if(!val) return;
val->~myClass(); // explicitly invoke dtor
free(val); // deallocate memory
}
};
...
myClass *val = myClass::create();
if(val) { ... }
myClass::destroy(val);
In this example I've used malloc and free to do all the allocating, you could use new (std::nothrow) and delete just as easily. You'll have to extract every operation that can fail out of your ctor and into the factory function so that you can check for errors without using exceptions. Even in this simple example, you can see this is a huge pain in the neck. You say you learned that "exceptions are not good coding style" in a comment, do you mean you learned that (whether by instruction with reasoned arguments and explanations, or from experience), or someone said "exceptions are not good coding style" and you've accepted the statement as dogma?
Using a bool initialized member leads to the zombie object problem (see http://www.parashift.com/c++-faq-lite/exceptions.html).