function not returning anything

Saaa empty at needmail.com
Thu Mar 20 20:41:36 PDT 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..
> 




More information about the Digitalmars-d-learn mailing list