[fpc-pascal] How to translate C macro

Darius Blaszyk dhkblaszyk at zeelandnet.nl
Mon Jan 2 21:57:35 CET 2017


Hi all,

Could someone suggest how to translate the following code to pascal?

#define prev(X) (  *( (void **) (  ((void *) (X)) - 32  ) )  )
.....
prev(ptr) = prev(last);

I tried converting the macro to an inline function but I get the error
message: Error: Argument cannot be assigned to.

The following does work but is a bit verbose. So therefore I would
prefer a clean solution if possible. I never have used macro's in FPC,
are they capable of doing the same as mentioned above?

( ppointer (  (pointer (ptr)) - 32  ) )^ := ( ppointer (  (pointer
(last)) - 32  ) )^;

Thanks in advance!

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


More information about the fpc-pascal mailing list