<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>I usually like using auto / auto* as much as possible.</div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">The one exception where I have found using auto confusing was for functions returning an std::optional. </div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">E.g.</div><div id="AppleMailSignature">auto value = maximum();</div><div id="AppleMailSignature">if (!value)<br> return;<br><br>I find that the check is confusing because it returns early if value is 0 in the case where maximum() returns an integer but checks if the value is set in the case the function returns an std::optional.<br><br><div style="direction: inherit;">Chris Dumez</div></div><div><br>On Jan 10, 2017, at 9:51 PM, Darin Adler <<a href="mailto:darin@apple.com">darin@apple.com</a>> wrote:<br><br></div><blockquote type="cite"><div><blockquote type="cite"><span>On Jan 10, 2017, at 9:49 PM, Darin Adler <<a href="mailto:darin@apple.com">darin@apple.com</a>> wrote:</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><blockquote type="cite"><span>On Jan 10, 2017, at 9:46 PM, Simon Fraser <<a href="mailto:simon.fraser@apple.com">simon.fraser@apple.com</a>> wrote:</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>auto countOfThing = getNumberOfThings();</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>ASSERT(countOfThing >= 0); // Can’t tell by reading whether the ASSERT is assured at compile time if countOfThing is unsigned</span><br></blockquote></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>I understand wanting to know, but I am not certain this is a bad thing.</span><br></blockquote><span></span><br><span>Sorry, let me say something different, but related:</span><br><span></span><br><span> int countOfThing = getNumberOfThings();</span><br><span></span><br><span>Can’t tell from the above code if getNumberOfThings() returns int or unsigned.</span><br><span></span><br><span>— Darin</span><br><span>_______________________________________________</span><br><span>webkit-dev mailing list</span><br><span><a href="mailto:webkit-dev@lists.webkit.org">webkit-dev@lists.webkit.org</a></span><br><span><a href="https://lists.webkit.org/mailman/listinfo/webkit-dev">https://lists.webkit.org/mailman/listinfo/webkit-dev</a></span><br></div></blockquote></body></html>