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

NULL->string() to eliminate UB, support MSVC 2022 #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

poelmanc
Copy link

@poelmanc poelmanc commented Oct 5, 2021

Per https://www.cplusplus.com/reference/string/string/string: "If s is a null pointer ... it causes undefined behavior."

This article by C++ Standards Committee member Aaron Ballman reinforces that: https://wiki.sei.cmu.edu/confluence/display/cplusplus/STR51-CPP.+Do+not+attempt+to+create+a+std%3A%3Astring+from+a+null+pointer

The MSVC 2022 Preview release, with /std:c++latest, flags this lines as an error.

Per https://www.cplusplus.com/reference/string/string/string: "If s is a null pointer ... it causes undefined behavior."

This article by C++ Standards Committee member Aaron Ballman reinforces that: https://wiki.sei.cmu.edu/confluence/display/cplusplus/STR51-CPP.+Do+not+attempt+to+create+a+std%3A%3Astring+from+a+null+pointer

The MSVC 2022 Preview release, with /std:c++latest, flags this lines as an error.
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.

1 participant