[webkit-dev] When to use "auto"? (I usually consider it harmful)

Geoffrey Garen ggaren at apple.com
Thu Jan 2 14:16:40 PST 2014


>> I think this use of “auto” is net harmful. 
> 
> I disagree. I think the use of auto is an improvement, because it makes it less likely that we have something like the following:
> 
> int wrong = something.get64BitInt(); // potential truncation

This argument is a red herring for two reasons:

(1) The example under consideration does not return an integer.

(2) The compiler warns about implicit integer truncation, and does not allow implicit truncation from int64 to int32 without a cast.

> Don’t we have this same problem with all of our JavaScript, Python, and Ruby code? We don’t have type specifications in those languages, but we manage to build large software with them as well.

To the contrary, we have never built anything the size of WebKit using Python.

Geoff


More information about the webkit-dev mailing list