View mode: basic / threaded / horizontal-split · Log in · Help
February 10, 2006
0.146 -run bug
No return statment:

$ cat a.d
import std.stdio;

int main() {
       writef("i kupa\n");
}

$ dmd a.d -run
i kupa
Error: AssertError Failure a(5)

Is this bug?


oh, and:
$ dmd -run a.d

will result in printing help. This way "#!dmd -run" will not work I
suppose ...


Anyway - neat stuff. Time to rewrite some of my daily used scripts. :>
February 10, 2006
Re: 0.146 -run bug
> int main() {
>         writef("i kupa\n");
> }

int main() {
	writef("i kupa\n");
	return 0;
}

left out the return. I've done that.

Dawid Ciężarkiewicz wrote:
> No return statment:
> 
> $ cat a.d
> import std.stdio;
> 
> int main() {
>         writef("i kupa\n");
> }
> 
> $ dmd a.d -run
> i kupa
> Error: AssertError Failure a(5)
> 
> Is this bug?
> 
> 
> oh, and:
> $ dmd -run a.d
> 
> will result in printing help. This way "#!dmd -run" will not work I
> suppose ...
> 
> 
> Anyway - neat stuff. Time to rewrite some of my daily used scripts. :>
February 10, 2006
Re: 0.146 -run bug
nascent wrote:

>  > int main() {
>  >         writef("i kupa\n");
>  > }
> 
> int main() {
> writef("i kupa\n");
> return 0;
> }
> 
> left out the return. I've done that.

Sorry, but I don't understand what are you trying to say. :)

I know that I've got no return statement, but IMO assert(...) is not right
way to communicate that. They are many posts of new users with "DMD's
warnings/errors are cryptic" and they are always "where?" replies. "Here". 

Sorry if I missunderstood your intentions (please be more verbose in such
circumstance).
February 10, 2006
Re: 0.146 -run bug
On Sat, 11 Feb 2006 10:10:26 +1100, Dawid Ciężarkiewicz  
<dawid.ciezarkiewicz@gmail.com> wrote:

> nascent wrote:
>
>>  > int main() {
>>  >         writef("i kupa\n");
>>  > }
>>
>> int main() {
>> writef("i kupa\n");
>> return 0;
>> }
>>
>> left out the return. I've done that.
>
> Sorry, but I don't understand what are you trying to say. :)
>
> I know that I've got no return statement, but IMO assert(...) is not  
> right
> way to communicate that.

Try compiling with "-w" switch.

"warning - test.d(2): function test.main no return at end of function"

-- 
Derek Parnell
Melbourne, Australia
February 10, 2006
Re: 0.146 -run bug
On Sat, 11 Feb 2006 00:10:26 +0100, Dawid Ciężarkiewicz  
<dawid.ciezarkiewicz@gmail.com> wrote:

> nascent wrote:
>
>>  > int main() {
>>  >         writef("i kupa\n");
>>  > }
>>
>> int main() {
>> writef("i kupa\n");
>> return 0;
>> }
>>
>> left out the return. I've done that.
>
> Sorry, but I don't understand what are you trying to say. :)
>
> I know that I've got no return statement, but IMO assert(...) is not  
> right
> way to communicate that. They are many posts of new users with "DMD's
> warnings/errors are cryptic" and they are always "where?" replies.  
> "Here".
>
> Sorry if I missunderstood your intentions (please be more verbose in such
> circumstance).

It's the compiler that should be more verbose :)

Is there a technical difficulty to adding a custom string? Or some reason  
why a string wouldn't be desirable i.e. performance? binary  
size/complexity?

This ties in with previous requests for custom strings on asserts, is it  
that there is a problem with doing it, or is it just a low priority  
feature?

The argument against them in the past has been that an assert is a debug  
tool and if you get one you simply look in the source for the cause of the  
assert and as such no custom string is required. I think there is some  
sound reasoning there but I think that the fact that this assert is not  
visible in the code makes it a good cadidate for a custom string and I  
suspect that once it was added user defined custom strings for user  
defined asserts would become a trivial feature to add.

I also imagine sending a customer a debug build in order to replicate a  
fault and debug it, in such a case an assert that could output the data it  
was asserting on, i.e.

assert(i < 10,"i(%d) >= 10",i);

would be a valuable debugging tool, no?

Regan
Top | Discussion index | About this forum | D home