[fpc-pascal] Translate C code

Darius Blaszyk dhkblaszyk at zeelandnet.nl
Sat Jan 6 01:39:14 CET 2018


Hi all,

Again I would like to ask some support on a piece C code that I need to
translate to pascal. The code in question is:

#define MEMNEXT(x) ((MyStruct *)(((char *) x) - ((char *) & (((MyStruct
*)0)->next))))

What exactly is going on here? Where does the result point to? It seems
like it starts with the pointer x and subtracts the size of the offset
of the beginning of MyStruct up to the "next" variable. At least that's
what I think is happening.

Does anyone has an idea how to translate this into working pascal code?

TIA!

Rgds, Darius
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20180106/f6606432/attachment.html>


More information about the fpc-pascal mailing list