Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2011-04

More doubts on C to pascal header translations:

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Paulo Costa

I saw that h2pas translated:

typedef void(*callback)(int pos, void* userdata);

to

callback = procedure (pos:cint; var userdata:pointer);cdecl;

shouldn't it be?

callback = procedure (pos:cint; userdata:pointer);cdecl;

Paulo Costa

Marco van de Voort
to Paulo Costa

In our previous episode, Paulo Costa said:

Show quoted text 7 lines
I saw that h2pas translated: typedef void(*callback)(int pos, void* userdata); to callback = procedure (pos:cint; var userdata:pointer);cdecl;

userdata is essentially untyped, so it doesn't matter what it exactly points too.

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?

Paulo Costa
to Marco van de Voort
Marco van de Voort wrote 11 lines
In our previous episode, Paulo Costa said: > I saw that h2pas translated: > > typedef void(*callback)(int pos, void* userdata); > > to > > callback = procedure (pos:cint; var userdata:pointer);cdecl; userdata is essentially untyped, so it doesn't matter what it exactly points too.

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...

Show quoted text 7 lines
> 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.

Paulo Costa