downs wrote:
Justin Johansson wrote:
Happy New Year 2010 Everybody.

Having resumed C++ nationality for the last few months, I kind of miss D's auto 
keyword.


If you're on gcc or a compiler that allows the typeof extension:

#define DECL(A, B) typeof(B) A = B

:)

Thanks. I uncovered the keyword recently when I inadvertently typed "typeof" instead of "typeid" and the editor in Eclipse CDT made no complaint. Consequently I searched both web and boost source for
for usages of typeof and soon found that it was just an extension
for gcc (and perhaps some others).

It's a real pity for C++ that typeof keyword hasn't been standardized. Accordingly Boost doesn't use typeof. However, I noticed that they sometimes make some use of the "typedef-decl-nested-inside-a-class-or-struct-trick" to exact static
type on occasions when typeof would otherwise suffice.

Cheers
Justin Johansson

Reply via email to