On 01/10/2012 15:21, dhkblas...@zeelandnet.nl wrote:
> I need to translate this: 
> #define mymalloc(x,y) (x*)malloc((y)* sizeof(x))
> 
> Is it possible using macro's in FPC or do I need to convert it to a
> procedure? How would I cast the pointer in the latter case (without
> having to change the sourcecode significantly)?
> 
> 
Not that I claim to /know/, but,
Is the purpose of this macro, to substitute 

(something) =  mymalloc(UInt, 5)
with
(something) = (Uint*)malloc(5*sizeof(UInt)) 

in source code (before compiling?) This means (something) is an array?

I'd definitively make it a function.

(haven't we got dynamic arrays for something like that ?)

> 
> Regards, Darius
> 
L.

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to