Hi Filip, Coming back to your earlier example:
> auto newSize = optimalSize(); > vs: > CGSize newSize = optimalSize(); If I understand your argument, you feel that the explicit CGSize declaration helps the reader because it makes the return value of optimalSize() explicit. However, that declaration is only stating the type that the author *thinks* optimalSize() returns. There is nothing to guarantee that optimalSize() returns a CGSize; only that it returns something that the compiler can turn into a CGSize through some set of casts. The code stating CGSize could have been correct at one point, but the return type of optimalSize might have been changed to some similar type without anyone noticing. Using ‘auto’ doesn’t seem to make this situation any worse. In fact, although Sutter’s suggestion of: auto newSize = CGSize { optimalSize(); } looks gross to my eye, it might be a useful approach because it would force the compiler to complain if we were returning something that was not explicitely a CGSize type. -Brent
_______________________________________________ webkit-dev mailing list webkit-dev@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-dev