Re: Save/load data to a file

2008-11-16 Thread Derek Parnell
and you can NOT going to be using the data in other CPU architectures, then the simplest is to just copy out the RAM bytes to disk. Of course, you have to add some 'structure' info to deal with the variable-length arrays but that can be as simple as prefixing the data with the length value. -- Derek Parnell Melbourne, Australia skype: derek.j.parnell

Re: How to compile and use an external class

2008-12-02 Thread Derek Parnell
tData) { SomeAttribute = InitData; } // A method int A_Method() { return SomeAttribute; } } - end of file - The line to compile these ... dmd myprogram myclass When running the program 'myprogram' you should get ... c:\>myprogram First 1 Second 5 -- Derek Parnell Melbourne, Australia skype: derek.j.parnell

Re: Cyclic Dependencies

2008-12-09 Thread Derek Parnell
d in that way no conversion is required. If for some reason you did want a run-time conversion then this should work ... wchar[] w = std.utf.toUTF16((true)? "true":"false"); -- Derek Parnell Melbourne, Australia skype: derek.j.parnell

Re: changing array lengths

2008-12-10 Thread Derek Parnell
ou have to do it the long way ... a.length = a.length + 30; -- Derek Parnell Melbourne, Australia skype: derek.j.parnell

Re: struct inheritance need?

2008-12-18 Thread Derek Parnell
ts the ability to have the compiler build class objects at compile-time such that when a program first starts running, the objects are already fully formed in RAM just waiting to be used. -- Derek Parnell Melbourne, Australia skype: derek.j.parnell

Re: struct inheritance need?

2008-12-19 Thread Derek Parnell
On Fri, 19 Dec 2008 04:07:40 -0500, Kagamin wrote: > Derek Parnell Wrote: > >> A static constructor (also known as the Module constructor) executes at >> program run-time and not at program compile-time. > > So do C++ static object constructors. Though C++ has synt

Re: .bat file to help compile easier - dmd/build

2009-01-02 Thread Derek Parnell
that information in the mario.d source file. eg. version(build) { pramga(link, alleg); } Then you no longer have to keep typing into the Bud command line, instead you just say ... build mario Use the return code from Bud to see if you can run the compiled program ... if errorlevel 0 mario -- Derek Parnell Melbourne, Australia skype: derek.j.parnell

Re: casting int[] to bool[]

2009-01-28 Thread Derek Parnell
d to use 'ints' as bool values you have to provide your own conversion routine. For example ... int[] a = [1,2,3,0]; bool[] b; -- Convert to int array to bool array. b.length = a.length; foreach( i, x; a) b[i] = (x != 0); writefln(a,`-->`,b); -- Derek Parnell Melbourne, Australia skype: derek.j.parnell

Re: new error in compailer

2009-01-31 Thread Derek Parnell
ni is not in any of these places. Which location DO you actually have sc.ini in? -- Derek Parnell Melbourne, Australia skype: derek.j.parnell

Re: new error in compailer

2009-01-31 Thread Derek Parnell
ve sc.ini in? >>>> >>>> -- I do not understand your answer. Can you tell us the full path that contains sc.ini? -- Derek Parnell Melbourne, Australia skype: derek.j.parnell

Re: Template conflict?

2009-02-15 Thread Derek Parnell
ils because of the literal '3'. The compiler cannot be sure if you want the 'int' or 'uint' function called because '3' matches both of them. You need to make the literal explicit... tblah(3u); -- uint call tblah(cast(int)3);

Re: array and pointer

2009-03-05 Thread Derek Parnell
* p; > int[3] s; > p = s; Try ... int* p; int[3] s; p = s.ptr; -- Derek Parnell Melbourne, Australia skype: derek.j.parnell

Re: No map file?

2009-03-23 Thread Derek Parnell
o it in Bud by not having DMD invoke the linker, instead I have Bud invoke the linker with the right options. The easiest way is to delete the .map files after compiling. -- Derek Parnell Melbourne, Australia skype: derek.j.parnell

Re: struct opCmp?

2009-05-14 Thread Derek Parnell
> > Oh, I figured either opEquals would be defined in terms of opCmp or an > overloaded opCmp would imply a new opEquals defined in terms of it, or > something like that. See http://www.digitalmars.com/d/1.0/operatoroverloading.html for actual list. -- Derek Parnell Melbourne, Australia skype: derek.j.parnell

Re: going beyond your bounds

2009-05-21 Thread Derek Parnell
10 ; b ~= 11 ; b[0] = 12 ; The result should now be: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] [12, 2, 3, 4, 5, 6, 7, 8, 9, 11] So remember, assigning one array to another is just creating an alias to the original array. You end up with two arrays pointing to the same data buffer. -- Derek Parnell Melbourne, Australia skype: derek.j.parnell

Re: going beyond your bounds

2009-05-21 Thread Derek Parnell
On Thu, 21 May 2009 05:37:59 -0400, MLT wrote: > Derek Parnell Wrote: > >> >> So remember, assigning one array to another is just creating an alias to >> the original array. You end up with two arrays pointing to the same data >> buffer. > > Yes. My question

Re: going beyond your bounds

2009-05-21 Thread Derek Parnell
hat is passedon the stack, so changing that will not change the argument's properties. eg. void func(int[] x) { x.length = x.length + 1; } int a[] = [1,2,3]; func(a); writefln("%s", a) //--> [1,2,3] and not [1,2,3,0] -- Derek Parnell Melbourne, Australia skype: derek.j.parnell

Re: Inside the switch statement

2009-06-09 Thread Derek Parnell
: STATEMENTS... case VAL2: STATEMENTS... case VAL3: STATEMENTS... } would only execute ONE of the selected cases. -- Derek Parnell Melbourne, Australia skype: derek.j.parnell

Re: Porting 1.x libraries to 2.x

2009-06-10 Thread Derek Parnell
You're correct in that version{} is no help at all. I use a text macro program to help me. -- Derek Parnell Melbourne, Australia skype: derek.j.parnell

Re: Tango Jake or other build system for Linux

2009-06-14 Thread Derek Parnell
ource.org/projects/build -- Derek Parnell Melbourne, Australia skype: derek.j.parnell

Re: Tango Jake or other build system for Linux

2009-06-14 Thread Derek Parnell
On Mon, 15 Jun 2009 15:06:24 +1200, Tim Matthews wrote: > Derek Parnell wrote: >> On Sun, 14 Jun 2009 15:16:51 + (UTC), Michal Minich wrote: >> >>> Is there any tool for Linux that can parse imports of files and invoke >>> compiler with all project files? (

Re: A public apology.

2009-06-15 Thread Derek Parnell
e yourself?? I've actually given up trying to influence D ... the patricians have made it too hard to contribute and I've haven't got *that* much free time. -- Derek Parnell Melbourne, Australia skype: derek.j.parnell

Re: How to print Chinese characters in console in window XP?

2009-06-27 Thread Derek Parnell
these characters (I > am using CP932) and you need an font that can represent these > characters. I assume OP already has both. Note that CP65001 does not > work.) I'm having troubles with this ... C:\temp>chcp 932 Invalid code page C:\temp>chcp 65001 Active code page: 650

switch ( Expression ) ScopeStatement

2009-07-06 Thread Derek Parnell
I see that the syntax for 'switch' is ... switch ( Expression ) ScopeStatement and ScopeStatement is either a BlockStatement or a NonEmptyStatement. Meaning that switch (i) j = k; is valid syntax! Why is that? -- Derek Parnell Melbourne, Australia skype: derek.j.parnell

Re: switch ( Expression ) ScopeStatement

2009-07-06 Thread Derek Parnell
On Mon, 06 Jul 2009 22:10:20 -0400, bearophile wrote: > Derek Parnell: >> is valid syntax! Why is that? > > To allow train-wrecks like this one: > > version(Tango) import tango.stdc.stdio; > void main(char[][] args) { > if (args.length > 1) > switch (args

Re: Usage of -deps

2009-07-06 Thread Derek Parnell
th it. While I've > just seen DMD2 produces an output file. Is this a D1 bug? I get exactly the same thing. Running with D1 gives an empty file and running with D2 gives a file with content. I'd say it looks like a bug, so bugzilla, here I come :-) -- Derek Parnell Melbourne, Australia skype: derek.j.parnell

Re: switch ( Expression ) ScopeStatement

2009-07-06 Thread Derek Parnell
se "1": Stdout("1"); // break; //uncomment and error } Ok, why on earth would a one-case switch be useful? And that still doesn't help me understand why allowing other statement types in that position is a good idea. -- Derek Parnell Melbourne, Australia skype: derek.j.parnell