We have a problem with deletion due to the woeful semantics
in the C++ standard.

When Felix operator new()  expression fails due to an exception,
the corresponding delete is called. Felix currently doesn't
supply one.

It is not clear if that delete gets the same arguments though.
I suspect it does not, the parameters have to be declared
to associate the delete function with the right new
operator, but the arguments aren't actually passed.
I can't find text in the Standard about this.

Any operator delete would HAVE to get the same arguments,
since the collector is one of them, and does the actual
deletion. The key thing here is NOT to invoke the finaliser,
since the compiler has taken care of unwinding the partially
constructed object already.

This template may support manual deletion:

template <class T> remove(collector *gc, T *p) {
  if(allocated_by_felix(p) gc->remove(p);
  else delete p;
}




-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to