Skybuck Flying
6/18/2011 10:26:00 PM
"Paul" wrote in message news:6O8Lp.11966$w86.9277@newsfe22.ams2...
"Skybuck Flying" <Windows7IsOK@DreamPC2006.com> wrote in message
news:6b599$4dfd0bc8$5419acc3$4652@cache2.tilbu1.nb.home.nl...
> Hello,
>
> I just came across something strange.
>
> 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 ?! ;)
>
"
A reference must always refer to an object, and you cannot have an object of
type void.
You can have a reference to a void pointer though.
void test(void* &data){ data = new double[12];}
void* p=0;
test(p);
p now points to 12x doubles .
"
You should test it first, I doubt your code works.
Better yet, look at the C test program provided and try to get it working,
whatever way you can without reasonable scope of the problem/goal/delphi
equivalent.
Bye,
Skybuck.