Thread overview
function not returning anything
Mar 21, 2008
Saaa
Mar 21, 2008
Saaa
March 21, 2008
byte function(){
..code..
//not returning anything
}


funtion();

After compiling/running it got me:
Error: Win32 exception

Is this correct?
It isn't really easy to debug like that.


March 21, 2008
"Saaa" <empty@needmail.com> wrote in message news:frv4ov$29n3$1@digitalmars.com...
> byte function(){
> ..code..
> //not returning anything
> }
>
>
> funtion();
>
> After compiling/running it got me:
> Error: Win32 exception
>
> Is this correct?
> It isn't really easy to debug like that.

Compile in non-release mode, and you'll get an error along the lines of "function 'foo' missing return."

The reason you get a "Win32 Exception" in release mode is because the compiler will put in an "assert(false, "that error message")" at the end of the function, and when compiled in release mode, "assert(false)"s get turned into an invalid opcode -- hence the exception.

It'd be kind of nice if they weren't, or if there were more fine-grained control over what happens to asserts, but..


March 21, 2008
I don't use -release.

C:\D\Compiler\bud_win_3.04.exe ain.d -inline -O -full -cleanup  -DCPATHC:\D\Compiler\D1\dmd\bin -Tmain.exe -IC:\D\Compiler\

-inline was the bad guy.

Thanks.


>> byte function(){
>> ..code..
>> //not returning anything
>> }
>>
>>
>> funtion();
>>
>> After compiling/running it got me:
>> Error: Win32 exception
>>
>> Is this correct?
>> It isn't really easy to debug like that.
>
> Compile in non-release mode, and you'll get an error along the lines of "function 'foo' missing return."
>
> The reason you get a "Win32 Exception" in release mode is because the compiler will put in an "assert(false, "that error message")" at the end of the function, and when compiled in release mode, "assert(false)"s get turned into an invalid opcode -- hence the exception.
>
> It'd be kind of nice if they weren't, or if there were more fine-grained control over what happens to asserts, but..
>