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

ES.30: Don’t use macros for program text manipulation #2136

Closed
jonnygrant opened this issue Sep 11, 2023 · 3 comments
Closed

ES.30: Don’t use macros for program text manipulation #2136

jonnygrant opened this issue Sep 11, 2023 · 3 comments

Comments

@jonnygrant
Copy link

The suggested C++ stringify example doesn't compile

https://godbolt.org/z/1vj3YE5GK

SpeedReach added a commit to SpeedReach/CppCoreGuidelines that referenced this issue Sep 30, 2023
The example should be passing in a constexpr and validating it at compile time like a macro, but instead passes a unknown value at compile time. Which may cause mislead and the code doesn't even work.

Ref: isocpp#2136
cubbimew pushed a commit that referenced this issue Oct 12, 2023
* ES.30 fix example code 

The example should be passing in a constexpr and validating it at compile time like a macro, but instead passes a unknown value at compile time. Which may cause mislead and the code doesn't even work.

Ref: #2136

* Update CppCoreGuidelines.md

Used enums instead of raw numbers.
@cubbimew
Copy link
Member

closed by #2143

@jonnygrant
Copy link
Author

jonnygrant commented Oct 13, 2023

There is a warning about the unused x,y params. Can those x,y there be removed?

<source>: In function 'void f(int, int)':
<source>:17:12: warning: unused parameter 'x' [-Wunused-parameter]
   17 | void f(int x, int y)
      |        ~~~~^
<source>:17:19: warning: unused parameter 'y' [-Wunused-parameter]
   17 | void f(int x, int y)
      |               ~~~~^

https://godbolt.org/z/hb41sfnsb

@jonnygrant
Copy link
Author

There is a warning about the unused x,y params. Can those x,y there be removed?

<source>: In function 'void f(int, int)':
<source>:17:12: warning: unused parameter 'x' [-Wunused-parameter]
   17 | void f(int x, int y)
      |        ~~~~^
<source>:17:19: warning: unused parameter 'y' [-Wunused-parameter]
   17 | void f(int x, int y)
      |               ~~~~^

https://godbolt.org/z/hb41sfnsb

#2152 filed

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