Add := digraph to D

Michel Colman michelcolman at mac.com
Fri Jun 22 12:27:28 PDT 2012


> I believe that auto has been redefined in C++11 as well. In 
> both, all it really
> means is that the type is inferred.

That's what I seemed to remember as well. Originally it had
something to do with scope, but it was basically obsolete because
that was the default anyway, so nobody was using it.

In the latest iteration of C++ they decided to redefine the
keyword to mean automatic type inference. This avoided having to
introduce a new keyword (which could break existing code that
happened to use that word for a variable name) and it was
unlikely to cause problems with old code. Storage class for local
variables is still the same default anyway so any code that relied
on variables being old-style "auto" would still work the same.

The only possible error could be if someone wrote "auto a = b"
as shorthand for "auto int a = b" with b some type other than
int, which would have been legal in very old versions of C but
extremely unlikely to ever be used since auto does nothing for an
int. They decided to take that chance :-)



More information about the Digitalmars-d mailing list