www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4755] New: assert(0,"...") error message

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4755

           Summary: assert(0,"...") error message
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2010-08-29 08:43:06 PDT ---
This D2 program:

void main() {
    assert(0, "This is a message");
}


With dmd 2.048 prints:
object.Error: assert(0) or HLT instruction

It doesn't print the line number nor the "This is a message".

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 29 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4755


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich gmail.com


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2010-08-29
10:50:43 PDT ---
assert(0) is special. It's not meant for debugging, it's meant as a "this piece
of code should never have been reached, shut down the application", at least in
release mode.

From TDPL:

"In non-release mode, assert(false) does not do anything special, it just
throws an AssertError exception"

"In release mode assert(false) will always cause a program to stop. There will
be no exception, the program will crash by executing the HLT instruction"

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 29 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4755


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


--- Comment #2 from bearophile_hugs eml.cc 2010-08-29 18:28:13 PDT ---
You are right, thank you. I have erroneously compiled it in release mode. There
is no bug here.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 29 2010