Jump to page: 1 2
Thread overview
[dmd 0.98] little bug
Aug 12, 2004
?
Aug 12, 2004
Id
Aug 12, 2004
Sebastian Beschke
Aug 12, 2004
Helmut Leitner
Aug 13, 2004
Derek Parnell
Aug 13, 2004
Ilya Minkov
Re: Internal error: ..\ztc\cod1.c 2495 (was [dmd 0.98] little bug)
Aug 13, 2004
J C Calvarese
Aug 13, 2004
Vathix
Aug 13, 2004
?
August 12, 2004
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());
}


August 12, 2004
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()); }


August 12, 2004
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
August 12, 2004

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
August 12, 2004
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".
This what you get when you use printf.
-- 
Dawid Ciężarkiewicz | arael
jid: arael@fov.pl
August 13, 2004
On Fri, 13 Aug 2004 01:15:06 +0200, Dawid Ciężarkiewicz 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".
> This what you get when you use printf.

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
August 13, 2004
? 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/
August 13, 2004
I reported it last month, news:cdt84u$pem$1@digitaldaemon.com


August 13, 2004
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"


August 13, 2004
Derek Parnell wrote:
>>> In fact the (little) error is that it is not an "Internal error".
>> This what you get when you use printf.
> 
> 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
« First   ‹ Prev
1 2