[fpc-devel] void test( void *data ) to procedure test( var data ); ? is it safe ?

Skybuck Flying skybuck2000 at hotmail.com
Sat Jun 18 22:43:40 CEST 2011

I had to convert "void test( void *data)" to Delphi/Pascal.

My first conversion was:

procedure test( data : pointer );

The documentation of the test function seems to indicate that this function returns all kinds of pointers, so it's like a call by reference call.

So I am starting to wonder if I perhaps should change it to something more convenient like:

procedure test( var data );

I was trying out c/c++ to see if void test( void &data ) would be valid/legal but to my surprise it was not (visual studio 2010).

So now I am wondering if it's safe to convert:

void test( void *data ) 


procedure test( var data );

I don't want no strange stack problems or access violations or anything like that, so I have to make sure it's 100% the same and safe ?!?

The convenience would be nice to have though...

My thoughts on the c/c++ inconsistency:

Prototypes for routines:

1: void test(void *data)
2: void test(void &data)

The first one does compile in visual studio 2010 and the second does not.

They both seem conceptually the same, like untyped variable data in Delphi, 
yet the first one is allowed and the second is not allowed.

Isn't that strange ?! ;) :)

Seems like case 2 is not yet implemented, either in the c/c++ language rules 
or in the compiler ?! ;)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20110618/65526855/attachment.html>

More information about the fpc-devel mailing list