<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Is there a possibility in a foreseeable future to separate C and
C++ languages, so that a proper parsing is done for each and
language-specific configurations appear? There are already few
grammars for Java, ObjC and even Javascript, so I make a
conclusion that clang-format developers, fortunately, do not have
any specific prejudice towards C, it might be just a matter of
time and human resources.</p>
<p>Oleksii<br>
</p>
<br>
<div class="moz-cite-prefix">On 17.5.2017 02:58, Richard Smith
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAOfiQq=_hMz87CAHZTS7-m-tEGpihwZbOiy+=GSSBvU0TuVJYA@mail.gmail.com">
<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"
moz-do-not-send="true">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:part2.7C43053B.6687FB5B@yahoo.com" alt=""
class="" height="140" width="543"><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>
</blockquote>
<br>
</body>
</html>