auto

janderson askme at me.com
Thu Jun 21 23:01:55 PDT 2007


Hoenir wrote:
> I still can't get the purpose of "auto".
> I know it makes it possible to e.g. write "auto y = 4u;" but why not 
> just "uint y = 4;"?

Its a generic/maintainable way of programming.  It means you can change 
the types your using without having to change ever reference to it.  It 
means you can copy paste or template a piece of code and have it work 
with little change.

It gets even more useful in larger programs when you start to layer this 
sort of general programming.

I hope that helps.


More information about the Digitalmars-d-learn mailing list