"R" suffix for reals
Walter Bright
newshound2 at digitalmars.com
Mon May 7 12:23:00 PDT 2012
On 5/7/2012 12:07 PM, Steven Schveighoffer wrote:
> However, I think these examples are misleading and do not prove the point. It
> shows IMO more that you are better off declaring the type on the left if your
> code depends on it always staying the same.
>
> i.e. this does not have that problem:
>
> real r = 1L;
I tend to agree. If you're declaring things with 'auto', then you should not be
relying on a specific type being inferred from the initializer - that would be
poor style. Use of auto implies your code is more generic and adaptable to
whatever type the initializer turns out to be.
If your usage of r requires it to be a specific type, it should be declared as
having that type.
More information about the Digitalmars-d
mailing list