Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GSL violates CppCoreGuidelines both ES.32 and ES.33: #801

Closed
jmatzen opened this issue Aug 7, 2019 · 1 comment
Closed

GSL violates CppCoreGuidelines both ES.32 and ES.33: #801

jmatzen opened this issue Aug 7, 2019 · 1 comment

Comments

@jmatzen
Copy link

jmatzen commented Aug 7, 2019

#define Expects(cond) GSL_CONTRACT_CHECK("Precondition", cond)

Naming violates both ES.32 and ES.33:

https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#S-interfaces

"Scream when you see a lower case macro." While it's not entirely lower case, obvious violation is obvious.

@B1Z0N
Copy link
Contributor

B1Z0N commented Aug 9, 2019

It is necessary, because it is another feature of GSL(see I.6 Expects and I.8 Ensures).

So it should stay named this way. We can change it to constexpr function, but two obstacles in our way:

  1. Not all compilers supporting gsl also support constexpr(not sure about this, i am new to this library, likely it is true, is it?).
  2. Why do we need to bother the compiler if we could just use bare macro and bother preprocessor? which seems to be a lot faster(not sure about this too, but i know that C++ compiler is slow, so preprocessor is likely to be faster, because it is more mindless, in a good way).

Yeah, i bet core guidelines have self-violations. It is a complex system, and self-violations are a property of complex systems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants