D
dev
using a function declared as non void type and not returning anything
to it...
invokes undefined behaviour...
_________________________
now if i write a function like this....
int foo(int a,intb){
/*.......*/
}/*no return*/
int main(){
if(foo(2,3)){}
return 0;
}
is this undefined behaviour??(in this program)
What i want to ask that since function is defined as non void type
return...so some memory location must be der where return of function
must be stored...may be it register,heap or stack...depending upon
implementation...
....
so some value must be der in that location....say any garbage
value....since we r not intrested in execution of if block....so i m
not concerned what i m getting in return....
so..is this correct program...
or m i misinterpreting something...??
__
regards
to it...
invokes undefined behaviour...
_________________________
now if i write a function like this....
int foo(int a,intb){
/*.......*/
}/*no return*/
int main(){
if(foo(2,3)){}
return 0;
}
is this undefined behaviour??(in this program)
What i want to ask that since function is defined as non void type
return...so some memory location must be der where return of function
must be stored...may be it register,heap or stack...depending upon
implementation...
....
so some value must be der in that location....say any garbage
value....since we r not intrested in execution of if block....so i m
not concerned what i m getting in return....
so..is this correct program...
or m i misinterpreting something...??
__
regards