[fpc-pascal] Re: using macros

2012-10-02 Thread leledumbo
Those macros are simply to reduce typing, better use true debugger. Even if RTTI can (which I believe not), it would be an abuse of the feature. Macros in FPC aren't as flexible as in C for a purpose IMHO: it's often abused as the way you show. -- View this message in context: http://free-pasc

[fpc-pascal] Re: using macros

2012-10-02 Thread dhkblaszyk
On 1 okt '12, 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 sourcec

[fpc-pascal] Re: using macros

2012-10-01 Thread leledumbo
If you want to port the code to clean Pascal, I suggest using related language feature, e.g. dynamic array. You can't really port that macro (even to a procedure / function), as the first parameter expected is a type name. If malloc returns Pointer, it doesn't need to be casted, the value is compat

[fpc-pascal] Re: using macros

2012-10-01 Thread Lukasz Sokol
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