www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - [dmd 0.98] little bug

reply ? <?_member pathlink.com> writes:
Hello,

i'm a newbee coder in D, and after a lot of work,
i have create a code whitch bug the compilator dmd

* Internal error: ..\ztc\cod1.c 2495

(I use dmd 0.98 for windows, and i use win xp)
we can see here the code which bug the compilator

//mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm

void fo_O1() {
}

void fo_O2() {
printf("%d",fo_O1());
}
Aug 12 2004
next sibling parent reply Id <Id_member pathlink.com> writes:
In article <cffkt9$25ja$1 digitaldaemon.com>, ? says...
Hello,

i'm a newbee coder in D, and after a lot of work,
i have create a code whitch bug the compilator dmd

* Internal error: ..\ztc\cod1.c 2495

(I use dmd 0.98 for windows, and i use win xp)
we can see here the code which bug the compilator

//mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm

void fo_O1() {
}

void fo_O2() {
printf("%d",fo_O1());
}

Hey, take a look at it more carefully, the error is yours! You're basically saying "print the result that fo_o1() gives as a integer". But you didn't see that method fo_01() returns void, that is, DOESN'T RETURN ANYTHING. So, how do you want to print a result that doesn't exist? This will work: int fo_O1(){ return -1; } void fo_O2(){ printf("%d", fo_O1()); }
Aug 12 2004
next sibling parent Sebastian Beschke <s.beschke gmx.de> writes:
Id wrote:

 In article <cffkt9$25ja$1 digitaldaemon.com>, ? says...
 
Hello,

i'm a newbee coder in D, and after a lot of work,
i have create a code whitch bug the compilator dmd

* Internal error: ..\ztc\cod1.c 2495

(I use dmd 0.98 for windows, and i use win xp)
we can see here the code which bug the compilator

//mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm

void fo_O1() {
}

void fo_O2() {
printf("%d",fo_O1());
}

Hey, take a look at it more carefully, the error is yours! You're basically saying "print the result that fo_o1() gives as a integer". But you didn't see that method fo_01() returns void, that is, DOESN'T RETURN ANYTHING. So, how do you want to print a result that doesn't exist? This will work: int fo_O1(){ return -1; } void fo_O2(){ printf("%d", fo_O1()); }

Sure, but the compiler should probably give an error message that's a little more helpful. So this could actually classify as an, insignificant, compiler bug. -Sebastian
Aug 12 2004
prev sibling parent reply Helmut Leitner <leitner hls.via.at> writes:
Id wrote:
 
 In article <cffkt9$25ja$1 digitaldaemon.com>, ? says...
Hello,

i'm a newbee coder in D, and after a lot of work,
i have create a code whitch bug the compilator dmd

* Internal error: ..\ztc\cod1.c 2495

(I use dmd 0.98 for windows, and i use win xp)
we can see here the code which bug the compilator

//mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm

void fo_O1() {
}

void fo_O2() {
printf("%d",fo_O1());
}

Hey, take a look at it more carefully, the error is yours! You're basically saying "print the result that fo_o1() gives as a integer". But you didn't see that method fo_01() returns void, that is, DOESN'T RETURN ANYTHING. So, how do you want to print a result that doesn't exist? This will work: int fo_O1(){ return -1; } void fo_O2(){ printf("%d", fo_O1()); }

Maybe the point is: the error message could be more readable for example: error: illegal use of void as value instead of: Internal error: ..\ztc\cod1.c 2495 In fact the (little) error is that it is not an "Internal error". -- Helmut Leitner leitner hls.via.at Graz, Austria www.hls-software.com
Aug 12 2004
parent reply Dawid =?UTF-8?B?Q2nEmcW8YXJraWV3aWN6?= <arael fov.pl> writes:
Helmut Leitner wrote:
 This will work:
 
 int fo_O1(){ return -1; }
 void fo_O2(){ printf("%d", fo_O1()); }

Maybe the point is: the error message could be more readable for example: error: illegal use of void as value instead of: Internal error: ..\ztc\cod1.c 2495 In fact the (little) error is that it is not an "Internal error".

-- Dawid Ciężarkiewicz | arael jid: arael fov.pl
Aug 12 2004
parent reply Derek Parnell <derek psych.ward> writes:
On Fri, 13 Aug 2004 01:15:06 +0200, Dawid Ciarkiewicz wrote:

 Helmut Leitner wrote:
 This will work:
 
 int fo_O1(){ return -1; }
 void fo_O2(){ printf("%d", fo_O1()); }

Maybe the point is: the error message could be more readable for example: error: illegal use of void as value instead of: Internal error: ..\ztc\cod1.c 2495 In fact the (little) error is that it is not an "Internal error".


Its got nothing to do with 'printf' or 'writef'. The problem is with varadic arguments. Try this ... # void somefunc(...) {} # void fo_O1() {} # void fo_O2() { somefunc(fo_O1()); } -- Derek Melbourne, Australia 13/Aug/04 10:10:06 AM
Aug 12 2004
parent reply Dawid =?UTF-8?B?Q2nEmcW8YXJraWV3aWN6?= <arael fov.pl> writes:
Derek Parnell wrote:
 In fact the (little) error is that it is not an "Internal error".


Its got nothing to do with 'printf' or 'writef'. The problem is with varadic arguments.

This is what I mean. BTW. Why to keep varadic arguments in D? I'm just courious. Wouldn't be good to let it by used with "C" linkage only. IMHO banning it let compiler to use PASCAL like function returning with asm { "ret <number>" } which I read is more efficient. I'm not the expert, but I always thought that variadic arguments lays in C++ becouse of C compatiblity. Maybe D should leave it. -- Dawid Ciężarkiewicz | arael jid: arael fov.pl
Aug 13 2004
parent Ilya Minkov <minkov cs.tum.edu> writes:
Dawid Ci=C4=99=C5=BCarkiewicz schrieb:

 BTW. Why to keep varadic arguments in D? I'm just courious. Wouldn't be=

 to let it by used with "C" linkage only. IMHO banning it let compiler t=

 use PASCAL like function returning with asm { "ret <number>" } which I =

 is more efficient. I'm not the expert, but I always thought that variad=

 arguments lays in C++ becouse of C compatiblity. Maybe D should leave i=

In fact, it's not really used in D - and those funcs in question are C=20 library functions. But why drop it? It's as crippled as in C. And we don't have a good=20 replacement for it yet, such as powerful array literals. And there=20 probably won't be any problem adding another varargs system later, as=20 the time comes - they can coexist well. In C, varargs affects performance, because the possible ambiguity=20 requieres that all functions have the same calling convention, which=20 happens to be a caller clean-up. C++ and D requiere that the functions=20 be declared before use, thus there is no ambiguity and the compilers=20 choose a calling convention depending on the function prototype - for=20 varargs functions caller clean-up is used, otherwise the more efficient=20 callee clean-up with possible register use. On the other hand, would we loose anything by disallowing varargs in "D" = convention right now? -eye
Aug 13 2004
prev sibling parent reply J C Calvarese <jcc7 cox.net> writes:
? wrote:

 Hello,
 
 i'm a newbee coder in D, and after a lot of work,
 i have create a code whitch bug the compilator dmd
 
 * Internal error: ..\ztc\cod1.c 2495
 
 (I use dmd 0.98 for windows, and i use win xp)
 we can see here the code which bug the compilator
 
 //mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
 
 void fo_O1() {
 }
 
 void fo_O2() {
 printf("%d",fo_O1());
 }

Good catch. I'm cross-posting this to the bug newsgroup, so that it might be easier for Walter to find and fix. *Bugs newsgroup for DMD* web interface: http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D.bugs usenet interface: news://news.digitalmars.com/digitalmars.D.bugs -- Justin (a/k/a jcc7) http://jcc_7.tripod.com/d/
Aug 12 2004
parent reply "Vathix" <vathixSpamFix dprogramming.com> writes:
I reported it last month,
news:cdt84u$pem$1 digitaldaemon.com
Aug 12 2004
parent ? <?_member pathlink.com> writes:
In article <cfh3pg$2qm6$1 digitaldaemon.com>, Vathix says...
I reported it last month,
news:cdt84u$pem$1 digitaldaemon.com

ooops : ), but now and with you, i know the link "Bugs newsgroup for DMD"
Aug 13 2004