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

Assign to a const char* when using std::getenv #237

Merged
merged 2 commits into from
Sep 20, 2024
Merged

Conversation

jmcarcell
Copy link
Member

BEGINRELEASENOTES

  • Assign to a const char* when using std::getenv

ENDRELEASENOTES

Discovered after AIDASoft/podio#676, it turns out that the one in Writer.cpp was not being assigned to const char* and it failed (it doesn't fail anymore after AIDASoft/podio#680). Because const auto translates to char* const while const auto* translates to const char*. Use *!

@tmadlener
Copy link
Contributor

What does "fail" mean in this case? It stored a wrong value? Or it didn't store anything because the whole if condition was evaluated as false?

@andresailer
Copy link
Contributor

None of the cases you describe correspond to what was there before?
const char* is supposed to be what is good, but it is changed to const auto*
and the other case is just auto which isn't in the list of things you describe what it evaluates to?

Why not be explicit and use char instead of auto? But at least align the release notes with what you do, which is assigning to const auto*?

@jmcarcell
Copy link
Member Author

What does "fail" mean in this case? It stored a wrong value? Or it didn't store anything because the whole if condition was evaluated as false?

Fail means failed to compile because of the static_assert in AIDASoft/podio#676.

None of the cases you describe correspond to what was there before? const char* is supposed to be what is good, but it is changed to const auto* and the other case is just auto which isn't in the list of things you describe what it evaluates to?

Why not be explicit and use char instead of auto? But at least align the release notes with what you do, which is assigning to const auto*?

I thought it was const auto and then the point I was making was that only const auto* will work with AIDASoft/podio#676. Anyway now it's const char*.

@andresailer andresailer merged commit 4836052 into main Sep 20, 2024
4 of 9 checks passed
@andresailer andresailer deleted the const-char-ptr branch September 20, 2024 07:19
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

Successfully merging this pull request may close these issues.

3 participants