Walter Bright <> changed:

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

--- Comment #3 from Walter Bright <>  2009-06-23 
13:15:25 PDT ---
If main() was typed to return a void, as a special case then the compiler will
insert a:
   return 0;
statement at the end.

But if a function is typed to return an int, then that's a contract saying the
programmer must put in some sort of return statement. If there is none, the
compiler inserts a:
   assert(0, "missing return expression");
at the end.

If you compile with -w, the compiler will warn you about this. (The compiler
doesn't always do this because it is perfectly legal for a function that is
typed to return an int to never return, such as if it calls abort().)

When compiling in release mode, assert(0) is replaced with a HLT instruction,
which generates a hardware exception at runtime. This is what you're seeing.

It's expected behavior. Not a bug.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to