[fpc-pascal] Translate C to Pascal

Vinzent Höfler JeLlyFish.software at gmx.net
Wed Aug 13 13:34:16 CEST 2008


Mattias Gärtner wrote:
> Zitat von Vinzent Höfler <JeLlyFish.software at gmx.net>:
> 
>> [...]
>>>>>   a: record end;
>>> Thanks. I will use that.
>> What for? The C statement is empty, it's not a variable and not even a
>> type. So before translating that into an empty Pascal-record, you should
>> rather look at what the actually used structur in the C-code is.
> 
> Actually the C-Code does what C can do really good: obfuscating.

Yeah.

> If I understand the code correct, the 'struct a;' itself is never used directly.
> It always uses 'struct a* foo'. So foo is a pointer to an empty struct
> a, which probably is the C equivalent of a typed pointer. To get strong type
> checking, I guess, it is ok to follow Felipe's advice:
> 
> type a = record end; pa=^a;

Well, I guess so, but it still doesn't make a lot of sense.

That "struct a" is not empty (storage size = 0), it is even non-existant 
(storage size = unknown). So the C-code may shuffle around the pointers, 
but unless this "struct a" (the "a" not even being a type here) is 
instantiated somewhere (internally in some library code?) such pointers 
are merely typed "void*".


Vinzent.



More information about the fpc-pascal mailing list