[fpc-devel] void test( void *data ) to procedure test( var data); ? is it safe ?
DrDiettrich1 at aol.com
Tue Jun 21 12:47:22 CEST 2011
Skybuck Flying schrieb:
> Passing real pointers and working with them becomes even more tricky and
> requires even more stars/asterixes.
> A very bad problem which was easily solved in pascal:
> procedure test( var a : integer );
> a := 5;
> test( a );
> ^ No stupid symbols needed ! ;) Much user friendly and pretty much does
> the same thing.
> Why make things more difficult then absolutely necessary huh ?! ;) :) =D
What does above code when called with Nil?
may result in a compiler error, the only cure would be to rewrite test as
procedure test(a: ^integer);
But how would you do that, when the converter decided to use
procedure test(var a: integer);
You'll have to *instruct* the converter to use the pointer form, and
that for *every single* subroutine in the C code.
A converter also cannot determine from a header file, whether the
implementation does something like this:
int test(int* a)
More information about the fpc-devel