LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 25195 - modernize check to use alternative operator representations
Summary: modernize check to use alternative operator representations
Status: NEW
Alias: None
Product: clang-tools-extra
Classification: Unclassified
Component: clang-tidy (show other bugs)
Version: unspecified
Hardware: All All
: P enhancement
Assignee: Unassigned Clang Bugs
URL:
Keywords:
: 32125 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-10-15 12:14 PDT by Eugene Zelenko
Modified: 2017-03-26 03:52 PDT (History)
5 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene Zelenko 2015-10-15 12:14:32 PDT
Will be good idea to have modernize check which could replace traditional operators representations with alternative ones: && with and, || with or, etc. See http://en.cppreference.com/w/cpp/language/operator_alternative.
Comment 1 Alexander Kornienko 2015-10-16 00:33:38 PDT
Why? Alternative tokens are only needed for the poor developers who have difficulties entering some characters (&|^~{}[]) due to the limitations of their environment. I have never seen a recommendation to use them in normal circumstances, and I would certainly refrain from suggesting their use as a style rule.
Comment 2 Eugene Zelenko 2015-10-16 11:58:06 PDT
(In reply to comment #1)
> Why? Alternative tokens are only needed for the poor developers who have
> difficulties entering some characters (&|^~{}[]) due to the limitations of
> their environment. I have never seen a recommendation to use them in normal
> circumstances, and I would certainly refrain from suggesting their use as a
> style rule.

I don't advocating use one or other style. For example, similar decision to use alternative names was made in project I'm working on at the end of 1980s in form of C macros.

Decision to use one or other style should be left for developers of particular project. Check will just help to maintain consistency.
Comment 3 Alexander Kornienko 2015-10-19 03:06:00 PDT
The question is whether there are projects/teams that are going to benefit from this proposed check.

FWIW, if someone gets to implement this, it seems sensible to implement conversion in both directions (controlled by an option): to alternative tokens and to classic operators.
Comment 4 Eugene Zelenko 2017-03-09 14:42:46 PST
*** Bug 32125 has been marked as a duplicate of this bug. ***
Comment 5 Gonzalo BG 2017-03-09 15:00:01 PST
> I have never seen a recommendation to use them in normal circumstances, and I would certainly refrain from suggesting their use as a style rule.

Some people consider them more readable, and recommend them, for example: http://stackoverflow.com/a/1704050/1422197

No need to share the opinion, but that some people do prefer them is a fact.
Comment 6 Matthias Gehre 2017-03-26 03:52:17 PDT
The other direction of this transformations is now proposed in https://reviews.llvm.org/D31308.