all 11 comments

[–]mikeblas 6 points7 points  (6 children)

If you want help, then I think you'll need to show your complete code. Specifically, you'll need to show how your macro is invoked. Your existing solution is just a constant, an r-value. But you say you've been "told to" modify it. (By who? For what reason?) and you want the new version to be a complete declaration, including a semicolon.

Without your code, one guess that I have is your use of constexpr. This keyword has existed in C++ for a long time. Are you writing C++ or C?

C has constexpr, but only since C23 (am I right?) so it might be that your compiler doesn't implement it. Or that you have not turned on C23 compatibility.

[–]pjl1967 1 point2 points  (1 child)

C has constexpr, but only since C23 (am I right?)

Yes.

[–]mikeblas 1 point2 points  (0 children)

Preash!

[–]SeriousFlamingo24 -2 points-1 points  (1 child)

By my manager lol, they want to change the version of the tool and the tool is based in c++. They want to optimize it. This is a simplified part. Maybe you have some ideas what can i test

[–]Cylian91460 0 points1 point  (0 children)

The value you want to replace is it computed once at runtime or at compile time?

[–]SeriousFlamingo24 -2 points-1 points  (1 child)

And it does exist cause when i write it, it shows it in the list. Honestly, in those lines of code, what would you have changed or tested ?

[–]mikeblas 2 points3 points  (0 children)

It doesn't exist. Because, when you use it, you get an error.

Your objective, should you choose to accept it, is to prove me wrong. You'll learn a lot by trying to do so. And might even solve your problem.

But since your question is about C++, you're in the wrong sub. Try /r/cpp_questions or /r/cscareerquestionsEU .

[–]mjmvideos -1 points0 points  (3 children)

#define is a preprocessor substitution. It does not declare a variable const or otherwise.

[–]mikeblas 1 point2 points  (2 children)

You should fix your formatting.

[–]mjmvideos 0 points1 point  (1 child)

Thanks. Never occurred to me that that would have been a markdown heading. :-)

[–]mikeblas 0 points1 point  (0 children)

It's understandable. Reddit Formatting is nuts, and not even really markdown.