a few MC++ / (Plain C++ really) questions about constructor & exception

  • Thread starter Thread starter Lloyd Dupont
  • Start date Start date
L

Lloyd Dupont

- if I use the default new operator, are all the instance variable
initialize to NULL / 0 ?
- if there is not enough memory what happend with new ? does it return NULL
or throw an exception?
- if new throw a native C++ exception what happen in Managed C++ ?!
- if there is an exception in a construtor, is ~MyClass() called?
- if I want to throw an exception in a constructor should I free all native
type before? or should I throw and let the destructor (which check nullity
before deleting) do its job?
 
Lloyd Dupont said:
- if I use the default new operator, are all the instance variable
initialize to NULL / 0 ?
- if there is not enough memory what happend with new ? does it return
NULL or throw an exception?
- if new throw a native C++ exception what happen in Managed C++ ?!
- if there is an exception in a construtor, is ~MyClass() called?
- if I want to throw an exception in a constructor should I free all
native type before? or should I throw and let the destructor (which check
nullity before deleting) do its job?

I suggest that you post again in

microsoft.public.dotnet.languages.vc

Regards,
Will
 
William DePalo said:
I suggest that you post again in

microsoft.public.dotnet.languages.vc
That's a good idea!
I didn't though of that as I don't usually do C++ programing....
But in some case, surprisingly, Managed C++ is much leaner...
 
Lloyd Dupont said:
But in some case, surprisingly, Managed C++ is much leaner...

It really excels when you need to make use of both managed and native
classes in the same module or executable by providing the "it just works"
capability as well as Platform/Invoke available to all the other languages.

Regards,
Will
 
Back
Top