Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C++, "canceling a construction"

Name: Anonymous 2009-11-04 15:25

Hi /prog/

My is simple, but perhaps not so frequent.

How should I stop a construction of an object (c++)?

Basically I have a class with some data members which must fulfill some requirements. Say we initialize these data members upon construction, if the supplied values were erroneous then I guess I want to stop construction and throw an error. Is this the right idea? How do I "cancel the construction"?

Help much appreciated :)

Name: Anonymous 2009-11-08 17:37

>>41
Good job retard, read my post from earlier: >>14

The whole point is to fix the code in the CALLERS. The best way to accomplish that (which the faq fails to mention) is to abort().

Also, I completely disagree with the FAQ about throwing an exception when a null pointer might have resulted from user input. That's plain fucking brain dead. Input validation should happen WAY sooner and should be very encapsulated; throwing exceptions is very much not the right way to handle bad user input.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List