auto in library functions

Jonathan M Davis jmdavisProg at gmx.com
Sun Dec 23 14:29:16 PST 2012


On Sunday, December 23, 2012 23:21:19 Benjamin Thaut wrote:
> It's always about local variables.

Then I don't agree with Andrej at all. For local variables, in general, I 
think that auto should be used unless you actually need to explicitly give the 
type. It makes refactoring the code much easier and reduces code breakage due 
to type changes. If it really helps to understand the code if you give the 
type, then it might make sense to give the type explicitly, but the 
combination of functions being called, variable names used, and what the code 
itself is doing usually makes it so that isn't really an issue.

- Jonathan M Davis


More information about the Digitalmars-d mailing list