On Thursday, 4 July 2013 at 20:00:18 UTC, Jeremy DeHaan wrote:
I've seen a lot of code lately that uses the auto keyword when declaring variables, but for some reason I don't really care much for it.

I'd like to make tutorials for a library I am working on, but I want to use "D style." Does such a style exist? Is auto generally preferred when declaring variables?

How often does everyone here use it?

Thanks much!
     Jeremy

I only use it if I have a long or ugly name, like
shared_ptr!(SomeType, SomeDeallocatorFunc) share = shared_ptr!(SomeType, SomeDeallocatorFunc)(new A(42));
Then I would write:
auto share = shared_ptr!(SomeType, SomeDeallocatorFunc)(new A(42));

because it is clear what share is and what type it should have.

Reply via email to