help-octave
[Top][All Lists]
Advanced

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

Re: overloading the global new/delete operator in octave


From: Sergei Steshenko
Subject: Re: overloading the global new/delete operator in octave
Date: Mon, 3 Aug 2009 00:13:52 -0700 (PDT)



--- On Sun, 8/2/09, Soeren Sonnenburg <address@hidden> wrote:

> From: Soeren Sonnenburg <address@hidden>
> Subject: overloading the global new/delete operator in octave
> To: "Octave users list" <address@hidden>
> Date: Sunday, August 2, 2009, 11:45 AM
> 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
> 
> -----Inline Attachment Follows-----
> 

It's probably a (wrong) long shot, but try

fprintf(stderr, "test\n");

- you know, (un)buffered output. Experimentally stdout sometimes takes a
lot of time/output to get flushed.

Regards,
  Sergei.


      



reply via email to

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