Skip to content

[SUGGESTION] Support (some) C++ alternative tokens #304

Closed
@JohelEGP

Description

@JohelEGP

I prefer writing (and, or) to (&&, ||). Currently, they're treated as identifiers. So cppfront emits an error if used C++1-correctly (x = y and z;, 3 identifiers in a row is ill-formed), or emits bad C++1 code (x = and;).

https://github.com/hsutter/cppfront/wiki/Design-note%3A-Postfix-unary-operators-vs-binary-operators talks about "alternative tokens". It seems they were supported at some point before this repository was published.

Will your feature suggestion eliminate X% of security vulnerabilities of a given kind in current C++ code? No (my guess).

Will your feature suggestion automate or eliminate X% of current C++ guidance literature? No (my guess).

Describe alternatives you've considered.

  1. Rejecting the suggestion. It goes against https://github.com/hsutter/cppfront/blob/main/.github/ISSUE_TEMPLATE/suggestion.md?plain=1#L10-L13 (it'd be easier to read the source if https://sembr.org/ was followed).
  2. Recognize them and
  • diagnose an use and suggest its alternative, or
  • try to emit valid C++ identifiers in their place (e.g., renaming to _and, with no portable way to name them from C++1).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions