[fpc-pascal] More doubts on C to pascal header translations:
paco at fe.up.pt
Mon Apr 25 13:31:10 CEST 2011
On 25/04/2011 08:58, Marco van de Voort wrote:
> In our previous episode, Paulo Costa said:
>> I saw that h2pas translated:
>> typedef void(*callback)(int pos, void* userdata);
>> callback = procedure (pos:cint; var userdata:pointer);cdecl;
> userdata is essentially untyped, so it doesn't matter what it exactly points
Right. The trouble here was that I see var foo as a reference to foo,
which means an implicit pointer. So var userdata:pointer is like a
pointer to pointer and that doesn't look like the original C code...
>> shouldn't it be?
>> callback = procedure (pos:cint; userdata:pointer);cdecl;
> It is a better translation, and also pointer style support NIL. Do you use
> -v or not?
OK. I did not use the -v option so I was wondering why it was selecting
the first option.
More information about the fpc-pascal