You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The reason will be displayed to describe this comment to others. Learn more.
Apparently, this was the problem. Basically, state.dataScheduleMgr->Schedule(SchedPtr).Name is a std::string and "" is a const char *. In order for this to be a well formed statement, "" has to be constructed into std::string also, but that std::string is temporary (it has the lifetime of the RHS expression) and so schedString is left dangling and will point to whatever ends up in that piece of memory at the time. Apparently, this is type unification rule of the conditional operator (and always has been), I've just never run into an actual case before. TIL.
58bbe38
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently, this was the problem. Basically,
state.dataScheduleMgr->Schedule(SchedPtr).Name
is astd::string
and""
is aconst char *
. In order for this to be a well formed statement,""
has to be constructed intostd::string
also, but thatstd::string
is temporary (it has the lifetime of the RHS expression) and soschedString
is left dangling and will point to whatever ends up in that piece of memory at the time. Apparently, this is type unification rule of the conditional operator (and always has been), I've just never run into an actual case before. TIL.58bbe38
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OutputProcessor2 (Myoldmopar) - Win64-Windows-10-VisualStudio-16: OK (2766 of 2766 tests passed, 0 test warnings)
58bbe38
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So why not create one to use in places that create a string_view?
DataGlobalConstants:
std::string constexp blankString = "";
58bbe38
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A string cannot be a
constexpr
, but aconst
one would work. We could do that.58bbe38
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OutputProcessor2 (Myoldmopar) - x86_64-Linux-Ubuntu-22.04-gcc-11.4: OK (3595 of 3595 tests passed, 0 test warnings)
58bbe38
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OutputProcessor2 (Myoldmopar) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-UnitTestsCoverage-Debug: OK (1978 of 1978 tests passed, 0 test warnings)
58bbe38
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OutputProcessor2 (Myoldmopar) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-IntegrationCoverage-Debug: OK (791 of 791 tests passed, 0 test warnings)