literals

so so at so.do
Sun Mar 28 06:03:57 PDT 2010


One more thing about the code :

T inv(T m)() {
	return 1.0 / m;
}

What if we call inv(5)?
This is an error, why?

- Function explicitly states that the parameter is a floating point type.
- Operations between floating point types and integers result a floating  
point type
, as you see from the return type, code returns the type of parameter, in  
this case an integer.

Thanks.



More information about the Digitalmars-d mailing list