Fwd: Could use help wrapping opencv function?

Attila Lendvai attila.lendvai at gmail.com
Sun Oct 6 10:41:33 UTC 2013


[this time to the list also]


> CV_INLINE  CvPoint  cvPoint( int x, int y )
> {
>     CvPoint p;
>
>     p.x = x;
>     p.y = y;
>
>     return p;
> }


it's been a while since i was fooling around with C... but 'p' is a
local variable on the stack, and if you return its address, then it
will point into nowhere when the C function's stack frame is unwound.

for that code you should receive a scary warning from any sane C
compiler.

and a bit of meta re your emails... read this:

http://www.catb.org/esr/faqs/smart-questions.html

--
• attila lendvai
• PGP: 963F 5D5F 45C7 DFCD 0A39
--
“Most people think they need a ruler. Perhaps we should give them a
fake one that doesn't actually do anything, and then they won't think
about it. It is sort of like giving an infant a pacifier.”
        — Perry Metzger



More information about the cffi-devel mailing list