February 01, 2004 Re: Read a file | ||||
---|---|---|---|---|
| ||||
Posted in reply to Manfred Nowak | How are you install stream.d and compile this? I have tried following: dmd stream_tes1.d stream.d i get the following errormessage from the linker: hansen@hansen-lx:~/d$ dmd stream_tes1.d stream1.d gcc stream_tes1.o stream1.o -o stream_tes1 -lphobos -lpthread -lm stream_tes1.o(.gnu.linkonce.t_Dmain+0x12): In function `_Dmain': : undefined reference to `_Class_7stream111__anonymous116ReadableFileStream_C7stream111__anonymous59BinaryReader_C7stream111__anonymous15Seeker_C6Object6Seeker12BinaryReader18ReadableFileStream' collect2: ld returned 1 exit status --- errorlevel 256 I have change the first line from stream.d to: module stream; The file's stream_tes1.d and stream.d are in the same directory. dmd -c stream_tes1.d stream.d run without any error. Manfred Manfred Nowak wrote: > Andy Friesen wrote: > >> Here's an attempt: >> http://ikagames.com/andy/d/stream.d > [...] > > Tested it like this: > > import stream; > > void main(){ > ReadableFile src=new ReadableFile(""); > while(!src.eof()){ > printf("."); > Console.writeLine= src.readLine; > } > Console.writeLine="Hello world\n"; > } > > > But it did not throw an error. > > So long. |
February 01, 2004 Re: Read a file | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andy Friesen | Andy Friesen wrote:
> This is puzzling.
Shame on me. I started the wrong program.
The compiled `stream.exe' throws the exception. Accidently I started `test.exe', which only showed, `Hello world'.
Sorry for the inconvenience.
So long.
|
February 01, 2004 Re: Read a file | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andy Friesen | > Since handle is a pointer, and not a reference, it doesn't matter. Doh , your right of course. > Modern C++ goes way, way further than this. Most compilers tremble at the mere mention of Loki. (a library made by the same author, for demonstrating the techniques implemented in the book) Hmm ok. You've done alot with D templates, anyway to convinvce you to write a tutorial on C++ and D templates ? I almost never write generic code in C++ but would like to in D. A tutorial would help alot of people, myself included. Also im a little confused on the use of interface , in C++ this would be a pure virtual abstract class ? How does interface work with templates , are there some advantages ? And looking over the code its not clear to me why you instantiate with Object , ill keep reading it. Thanks, C "Andy Friesen" <andy@ikagames.com> wrote in message news:bvh82p$2p2c$1@digitaldaemon.com... > C wrote: > > Quick note ( 859 ) > > return handle != null; > > > > should read !== null ( i know u know this ). > > Since handle is a pointer, and not a reference, it doesn't matter. I suppose it's a good idea, though, as it's better self-documentation if it consistently behaves like a reference. > > > > > I like this template stacking , 'bolt-ins' you call them ? Looks like fun , > > Ill play around with them :D. Is Modern C++ the only book that does things > > like this ? Another source of documentation , examples , tutorial would be > > cool too. > > Modern C++ goes way, way further than this. Most compilers tremble at the mere mention of Loki. (a library made by the same author, for demonstrating the techniques implemented in the book) > > > > > Also some unittests and examples ? > > > > Good idea. > > -- andy |
Copyright © 1999-2021 by the D Language Foundation