[cffi-devel] How would i write the exact equivelant of a C New Operator

Joeish W joeish80829 at yahoo.com
Mon Oct 28 08:15:01 UTC 2013


Im converting this code here

int board_n = board_w * board_h; 

CvPoint2D32f* corners = new CvPoint2D32f[ board_n ];

from this link http://dasl.mem.drexel.edu/~noahKuntz/openCVTut10.html

and in the code is a new operator id like to convert but i could use guidance how.
first of all i looked on google and there actually doesnt appear to   be a C new operator only C++ which is a little weird because the code at the above link is full of only OpenCV C functions so either there is a C new operator or the author is using C and C++ together. I was going to do foreign-alloc but at thislink about the new operator for C++ it says 
"Allocatescountbytes from free store. Calls the function pointer returned by std::get_new_handler on failure and repeats allocation attempts until new handler does not return or becomes a null pointer, at which time throws std::bad_alloc."

I dont really know what to make of that and that link is for C++...thus the reason for my question....any guidance is appreciated
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cffi-devel/attachments/20131028/13a46f7e/attachment.html>


More information about the cffi-devel mailing list