Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MOHAWK: Don't initialize a null pointer, to make VS2010 happy.
- Loading branch information
Showing
1 changed file
with
4 additions
and
1 deletion.
There are no files selected for viewing
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
44e79c7
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.
I guess if you made that "return;" instead of "break;" after the error it might very well be that MSVC won't complain even when you initialize value to 0.
44e79c7
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.
The break or return shouldn't be necessary at all, even in MSVC, since error() is marked __declspec(noreturn).
44e79c7
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.
Propaly, maybe it just doesn't detect it then.
44e79c7
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.
It complains about the value pointer being used without being initialized on line 839, so you either need to set it to a proper value (that is never actually used if I understand the code properly) or add an error like you did, but only one of those is actually required.
I think the error in the default case is better, and the error call is all that is needed, no need for return or break, or initializing the pointer to a default value.
44e79c7
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.
Yeah in this case it is fine to not add a return after error, still in general you want to do that, since we also support compilers which do not feature any noreturn marking, like MIPSpro IIRC. That way you avoid many nasty warnings/errors on such systems.