digitalmars.D.bugs - assert bug
- Tiago Gasiba <tiago.gasiba gmail.com> Nov 23 2005
- zwang <nehzgnaw gmail.com> Nov 23 2005
- Tiago Gasiba <tiago.gasiba gmail.com> Nov 23 2005
The following code compiles OK but behaves differently if you change the
function return value from double to void:
double f( double p ){
//void f( double p ){
assert( p>0.0 );
}
int main( ){
double p = 10.01;
f( p );
return 0;
}
Tiago
--
Tiago Gasiba (M.Sc.) - http://www.gasiba.de
Everything should be made as simple as possible, but not simpler.
Nov 23 2005
Tiago Gasiba wrote:The following code compiles OK but behaves differently if you change the function return value from double to void: double f( double p ){ //void f( double p ){ assert( p>0.0 ); } int main( ){ double p = 10.01; f( p ); return 0; } Tiago
Nothing wrong here. When the return type is not void, and your function doesn't return a value, dmd inserts an "assert(0);" at the end of the function.
Nov 23 2005
zwang schrieb:Tiago Gasiba wrote:The following code compiles OK but behaves differently if you change the function return value from double to void: double f( double p ){ //void f( double p ){ assert( p>0.0 ); } int main( ){ double p = 10.01; f( p ); return 0; } Tiago
Nothing wrong here. When the return type is not void, and your function doesn't return a value, dmd inserts an "assert(0);" at the end of the function.
True. Shame on me :) I have found a bug on assert, though, that crashes with SIGSEGV. I'll try to reproduce it again and then post it. Tiago -- Tiago Gasiba (M.Sc.) - http://www.gasiba.de Everything should be made as simple as possible, but not simpler.
Nov 23 2005








Tiago Gasiba <tiago.gasiba gmail.com>