January 21, 2005 void* to int*? | ||||
---|---|---|---|---|
| ||||
Well, I've been trying to do file I/O... the only problem is, dmd 0.110 refuses to allow the conversion from void* to int*, which I find extremely bizarre... How can one do file I/O with only the ability to read text (Write, on the other hand, works fine, since int[] to void[] is of quite workable.) Have I missed something here? Or is pointer manipulation truly disabled, and I failed to notice in the documentation? |
January 22, 2005 Re: void* to int*? | ||||
---|---|---|---|---|
| ||||
Posted in reply to BreMac | BreMac schrieb in news:csrmfk$oof$1@digitaldaemon.com : > Well, I've been trying to do file I/O... the only problem is, dmd 0.110 refuses > to allow the conversion from void* to int*, which I find extremely bizarre... > How can one do file I/O with only the ability to read text (Write, on the > other hand, works fine, since int[] to void[] is of quite workable.) > Have I missed something here? Or is pointer manipulation truly disabled, and I > failed to notice in the documentation? I currently don't have dmd 0.110 at hand, but the sample below used to work. #import std.c.stdlib; # #int main(){ # int* x; # x = cast(int*) malloc(int.sizeof * 2); # *x = 13; # *(x+1) = 0; # void* y = x; # int* z = cast(int*) y; # assert(*z==13); # assert(*(z+1)==0); # return 0; #} If this fails with the lates dmd version then please send a bug report. Thomas |
Copyright © 1999-2021 by the D Language Foundation