help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

overloading the global new/delete operator in octave


From: Soeren Sonnenburg
Subject: overloading the global new/delete operator in octave
Date: Sun, 02 Aug 2009 20:45:22 +0200

Dear all,

I am a bit puzzled why my overloaded global new[] operator does not
become effective when building a octave extension (it works with
python/matlab though)...

I declare something like

void* operator new[](std::size_t size) throw (std::bad_alloc)
{
    printf("test\n");
}

DEFUN_DLD (sg, prhs, nlhs, "shogun.")
{
    volatile int* foo = new int[2];
}

but don't see the test output... In the octave src I only see in
oct-obj.h *local* overloading of new/delete but no more?

I also wonder why the in this file new(size_t size, void*p) function is
declared... looks to me like a nop - orhas this the same cause...?

  // FIXME -- without this, I have errors with the stack of
  // octave_value_list objects in ov-usr-fcn.h.  Why?
  void *operator new (size_t size, void *p)
    { return ::operator new (size, p); }

Hmmhhh...
Soeren
-- 
For the one fact about the future of which we can be certain is that it
will be utterly fantastic. -- Arthur C. Clarke, 1962

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]