"ctick" <ct***@flare.com> wrote...
Is it a good idea to construct some other objects using "new" within a
constructor of a class in two cases, exception disabled and enabled?
If exceptions are disabled, you probably use '(nothrow)' version
of 'new' and then you get NULL when cannot allocate, and have to
put your constructed object in some kind of "incomplete" state,
which should be queriable. If exceptions are enabled (as in any
normal situation, I am not sure why one would disable them, well,
maybe to compile code for ROM or something), then the object
creation (invocation of the constructor) has to be 'tried' and
exceptions need to be caught. But that should be pretty usual by
now.
You should probably decide for yourself whether programming that
'incompletely constructed' state in your object is a good idea; it
is a decent work-around (around the absence of exceptions) IMO.
V