auto

Derek Parnell derek at nomail.afraid.org
Wed Jun 20 19:31:58 PDT 2007


On Wed, 20 Jun 2007 21:37:44 -0200, Ary Manzana wrote:

> Derek Parnell escribió:
>> On Wed, 20 Jun 2007 14:20:43 +0200, 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;"?
>> 
>>    auto y = someFunc();   // What type is it now?
>> 
> 
> // What can you do with y now, if you don't know the type?

Pass it to a function that does know its type.


  void funcA(int X) {  }
  void funcA(float X) { }
  void funcA(char[] X) { }

  auto y = someFunc();

  funcA(y);


-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
21/06/2007 12:30:47 PM


More information about the Digitalmars-d-learn mailing list