Thread overview
[Bug 64] New: Unhandled errors should go to stderr
Mar 22, 2006
d-bugmail
Mar 23, 2006
d-bugmail
Mar 23, 2006
d-bugmail
Mar 23, 2006
Don Clugston
Mar 23, 2006
Stewart Gordon
March 22, 2006
http://d.puremagic.com/bugzilla/show_bug.cgi?id=64

           Summary: Unhandled errors should go to stderr
           Product: D
           Version: 0.150
          Platform: All
               URL: http://www.digitalmars.com/drn-
                    bin/wwwnews?digitalmars.D.bugs/2001
        OS/Version: All
            Status: NEW
          Keywords: wrong-code
          Severity: critical
          Priority: P1
         Component: Phobos
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: smjg@iname.com


When an exception is thrown and the application doesn't handle it, the default handler outputs the error message to stdout.  This is wrong.  It should go to stderr.  That's exactly what stderr's there for.

Walter once claimed that he doesn't really like stderr, apparently because versions of Windows prior to 2000 don't provide a means of redirecting it.  I have debunked this excuse at least three times over:

1. By pointing out that the spec states that "the program gracefully exits through the default error handler with an appropriate message".  Redirecting error output when the user didn't ask for it, be it to a file, a filter or a program such as Doxygen, is most ungraceful.

2. By stating that whether to redirect errors along with normal output should be up to the user, not the programmer, and certainly not the creator of the language that the program is written in.

3. By writing Rederr and releasing it on digitalmars.D.announce:

http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D.announce/1518


The fix was written ages ago:

http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D.bugs/4368


-- 

March 23, 2006
http://d.puremagic.com/bugzilla/show_bug.cgi?id=64


braddr@puremagic.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |normal
           Keywords|wrong-code                  |diagnostic
           Priority|P1                          |P2




------- Comment #1 from braddr@puremagic.com  2006-03-23 01:23 -------
Sorry, choice of stdout vs stderr for the last ditch catch isnt:

Critical        crashes, loss of data, severe memory leak
P1      so bad that an update needs to happen immediately; i.e. it makes D
unusable

I've lowered it back to normal and P2.

I do agree that stderr is more appropriate.


-- 

March 23, 2006
http://d.puremagic.com/bugzilla/show_bug.cgi?id=64





------- Comment #2 from smjg@iname.com  2006-03-23 04:22 -------
Sorry, I was thinking of it as silent generation of bad code, which Walter once suggested should count as critical.  Should've finished reading that discussion I guess....


-- 

March 23, 2006
d-bugmail@puremagic.com wrote:
> http://d.puremagic.com/bugzilla/show_bug.cgi?id=64
> 
> ------- Comment #2 from smjg@iname.com  2006-03-23 04:22 -------
> Sorry, I was thinking of it as silent generation of bad code, which Walter once
> suggested should count as critical.  Should've finished reading that discussion
> I guess....

Silent generation of bad code is a thousand times more serious than a memory leak, or even a segfault (after all, it could potentially cause segfaults in thousands of apps!). I really think the categories for a compiler are fundamentally different from those for any other type of application.

I'm not sure that this particular issue is bad code generation though. And certainly not a P1. Since D is currently usable, a P1 can only apply to a regression.

March 23, 2006
Don Clugston wrote:
<snip>
> I'm not sure that this particular issue is bad code generation though. And certainly not a P1. Since D is currently usable, a P1 can only apply to a regression.

The question here is whether you can call it bad code *generation*. It's bad code in the Phobos source, which the compiler is correctly translating.  The object code that's being generated is indeed bad, it's just not the compiler's fault.

Stewart.

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/M d- s:-@ C++@ a->--- UB@ P+ L E@ W++@ N+++ o K-@ w++@ O? M V? PS- PE- Y? PGP- t- 5? X? R b DI? D G e++>++++ h-- r-- !y
------END GEEK CODE BLOCK------

My e-mail is valid but not my primary mailbox.  Please keep replies on the 'group where everyone may benefit.