<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 16 May 2017 at 09:15, Oleksii Vilchanskyi via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<p>Hi everybody,</p>
<p>Here is a code sample:</p>
<img src="cid:part1.8E9EDC65.40A136C0@yahoo.com" alt="" width="543" height="140"><br>
<br>
It was formatted with <tt>SpaceAfterCStyleCast: true </tt>option.
However, while <tt>bool</tt> was formatted, <tt>uint8_t</tt>
wasn't. Looks like a bug to me. Or is it a feature? Full config is
in the attachment.<br></div></blockquote><div><br></div><div>This is one of the cases for which the C and C++ grammars require contextual information to parse, which is where clang-format is most likely to make mistakes. Consider:</div><div><br></div><div> int uint8_t(int); // a function, not a type</div><div> x = (uint8_t)(123); // not a cast</div><div><br></div><div>However, given the relative frequency of that case and of C-style casts, clang-format should probably be assuming that this syntax is a cast. (It's not completely clear, though; parenthesizing the function name is an idiom for turning off ADL, and it's possible that there are codebases that make heavy use of that idiom.)</div></div></div></div>