Suggestion: shortcut for 'new X'
BCS
BCS at pathlink.com
Thu Aug 24 11:17:23 PDT 2006
Kristian wrote:
>
> However, I don't think that it's good programming style to use auto
> a lot. :/
>
substitute excessive for a lot and I agree.
> Consider the following:
>
> Obj func2() {...}
>
> void func() {
> auto obj = func2();
> }
>
> When looking at 'func()' only it's impossible to know the type of 'obj'.
that can be a bit of a gotcha. I haven't done it but putting in a
static assert(is(obj : Obj));
could serve as a bit of type documentation and as a guard against API
changes.
More information about the Digitalmars-d
mailing list