[Issue 4572] std.file.read return type
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Wed Aug  4 05:52:32 PDT 2010
    
    
  
http://d.puremagic.com/issues/show_bug.cgi?id=4572
--- Comment #6 from bearophile_hugs at eml.cc 2010-08-04 05:52:31 PDT ---
Thank you for your answer Steven.
> then, you must cast your data to a ubyte[].  But void[] can be implicitly cast
> to from anything, so void[] wins here.
If you compile this program with dmd 2.047:
void main() {
    auto v = new void[10];
    ubyte a1, a2;
    a1 = v;
    v = a2;
}
It produces the errors:
test.d(4): Error: cannot implicitly convert expression (v) of type void[] to
ubyte
test.d(5): Error: cannot implicitly convert expression (a2) of type ubyte to
void[]
> But we can forgo all this stuff if we add a template parameter to read, so you
> can specify exactly the type you want.  If you know your file is a bunch of
> int's, you could do:
> std.file.read!(int)();
It seems a good idea. So I presume std.file.read!(int[])(); reads a matrix.
-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
    
    
More information about the Digitalmars-d-bugs
mailing list