[cfe-dev] RFC: clang-tidy readability check to reduce clutter: unnecessary use of auto and ->

Larry Evans via cfe-dev cfe-dev at lists.llvm.org
Mon Nov 9 01:37:30 PST 2015


On 11/07/2015 11:18 AM, Richard via cfe-dev wrote:
> 
> [Please reply *only* to the list and do not include my email directly
> in the To: or Cc: of your reply; otherwise I will not see your reply.
> Thanks.]
> 
> In article <563DC703.4000507 at gmx.net>,
>     Fabio Fracassi via cfe-dev <cfe-dev at lists.llvm.org> writes:
> 
>> Hi,
>>
>> On 06/11/2015 19:08, Richard via cfe-dev wrote:
>> [...]
>>> N2541 <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2541.htm>
>>> introduced auto and the trailing return type syntax.
>>>
>>> Now people are using auto and -> on function signatures where the
>>> return type is stated explicitly anyway.  This results in code like:
>>>
>>> auto main() -> int
>>> {
>>>    return 0;
>>> }
>> so?
>>
>>> Srsly?  Is this really improving anything over
>>>
>>> int main()
>>> {
>>>    return 0;
>>> }
[snip]
>> and for mathematically inclined people it is also 
>> more natural.
> 
> I didn't know you were appointed spokesman for all mathematically
> inclined people?  Seriously, I'm a mathematically inclined person and
> I don't find this more natural.
> 

Isn't Haskell a more mathematically inclined language and doesn't
it use:

  (S1,S2) -> T

to represent the same type as T(*)(S1,S2) in c++.
Also, I see the expression S -> T in math texts whereas I
don't remember ever seeing the c++ syntax to represent
function types in math texts.  Of course I'm no math
expert, but it sure seems that S -> T is used much
more frequently in math texts.

-regards,
Larry






More information about the cfe-dev mailing list