www.digitalmars.com         C & C++   DMDScript  

D - dmd(.exe) crash

reply Marc Michel <Marc_member pathlink.com> writes:
using windows XP pro SP1 :
( tested on Athlon XP and pentium IV machines )

file myclass.d :
--------------------------8<----------------------------------------
// myclass
import std.c.stdio;
class myclass {
void sayhello() {
puts("hello");
}
}
--------------------------8<----------------------------------------

file crash.d
--------------------------8<----------------------------------------
import std.c.stdio;
import myclass;
void main ( ) {
myclass c=new myclass;
c.sayhello();
}
--------------------------8<----------------------------------------


compiling with : "dmd crash myclass"
makes dmd.exe crash.

putting the def of myclass into crash.d and compiling with "dmd crash"
compiles and works fine !!

Even if I'm doing something wrong; I suppose, dmd should (only) insult me... :)
Feb 20 2004
parent reply larry cowan <larry_member pathlink.com> writes:
You have picked up a default module name for myclass.d file of myclass.
Your class has the exact same name, which conflicts.

Changing the classname to MyClass, or the filename to Myclass.d or renaming
either one to something else will compile and run ok.  If the filename is
changed, change the import statement too.  On general principles, add a module
statement at the front of the non-main() file.

Sorry about the crash, but that's what is happenning.  Normally we start
classnames with a capital letter (and the first of each other word in the name).
Module names (and fileames) are usually all lower case.  This is probably why
you haven't seen a lot of complaints.

[Walter] - this crash could come up with a lot of new users, so it's
particularly bad public relations.

-larry

In article <c14jv0$17h1$1 digitaldaemon.com>, Marc Michel says...
using windows XP pro SP1 :
( tested on Athlon XP and pentium IV machines )

file myclass.d :
--------------------------8<----------------------------------------
// myclass
import std.c.stdio;
class myclass {
void sayhello() {
puts("hello");
}
}
--------------------------8<----------------------------------------

file crash.d
--------------------------8<----------------------------------------
import std.c.stdio;
import myclass;
void main ( ) {
myclass c=new myclass;
c.sayhello();
}
--------------------------8<----------------------------------------


compiling with : "dmd crash myclass"
makes dmd.exe crash.

putting the def of myclass into crash.d and compiling with "dmd crash"
compiles and works fine !!

Even if I'm doing something wrong; I suppose, dmd should (only) insult me... :)
Feb 20 2004
parent Lanael <lanael easynet.fr> writes:
In article <c15qs8$joq$1 digitaldaemon.com>, larry_member pathlink.com 
says...
 You have picked up a default module name for myclass.d file of myclass.
 Your class has the exact same name, which conflicts.
Ok, thanks for the (quick) answer. I see my mistake, now !
 [Walter] - this crash could come up with a lot of new users, so it's
 particularly bad public relations.
I'm eager to see the dmd R1.0 !!
 -larry
Feb 21 2004