dwavesystems / dwavesystems/dwave-optimization

Style: Consider allowing `and`, `or`, and `not` keywords in C++ code

Open
#399 0 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
C++
Stars
31
Forks
36
Avg merge
16h 55m
Merged PRs (30d)
8

Description

C++ supports `and`, `or`, `not` [keywords](https://en.cppreference.com/w/cpp/keywords.html). `not` especially seems much more readable to me in `if`-clauses
```c++
if (not std::is_sorted(range)) {}
```
vs
```c++
if (!std::is_sorted(range)) {}
```
Currently we don't use them anywhere in the code base, mostly because the [Google C++ style guide]( https://google.github.io/styleguide/cppguide.html#Boolean_Expressions) disallows them
> Also note that you should always use the punctuation operators, such as && and ~, rather than the word operators, such as and and compl.

But IMO we should diverge for readability. Though this is coming from someone who was raised on Python.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.