On Thursday, 21 June 2012 at 10:01:18 UTC, Jonathan M Davis wrote:
On Thursday, June 21, 2012 11:14:40 Lars T. Kyllingstad wrote:
That said, I was still wrong. :)  I just tried it now, and
apparently you can write pointless stuff like "auto extern int
foo;" and DMD will compile it just fine. (And, unless that is a bug, it means D has redefined 'auto' to mean absolutely nothing,
except to be a marker saying "this is a declaration", allowing
one to omit both storage class and type.)

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

The history of 'auto' in C++ is actually a bit interesting. Here's a bit from Bjarne Stroustrup's C++11 FAQ (which is an awesome resource, btw):

"The auto feature has the distinction to be the earliest to be suggested and implemented: I had it working in my Cfront implementation in early 1984, but was forced to take it out because of C compatibility problems. Those compatibility problems disappeared when C++98 and C99 accepted the removal of "implicit int"; that is, both languages require every variable and function to be defined with an explicit type. The old meaning of auto ("this is a local variable") is now illegal. Several committee members trawled through millions of lines of code finding only a handful of uses -- and most of those were in test suites or appeared to be bugs."


auto should probably be removed from the list of storage classes
in the D spec, then.

The spec isn't _at all_ clear on what on earth a storage class is in D. I
tried to get clarification on that not too long ago and failed.

At the very least, if we keep using that term, it should have something to do with how stuff is stored. ;)

-Lars

Reply via email to