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

No Compiler warning for missing case in Switch statement #49

Closed
Ar5ham opened this issue Sep 19, 2017 · 8 comments
Closed

No Compiler warning for missing case in Switch statement #49

Ar5ham opened this issue Sep 19, 2017 · 8 comments

Comments

@Ar5ham
Copy link

Ar5ham commented Sep 19, 2017

Copy pasting the SafeSwitch example to project created via Visual Studio 2017 and compiling the project, no warning is being produced by the compiler.

Compiler Version:

# From Developer Command Prompt for VS 2017
>cl
Microsoft (R) C/C++ Optimizing Compiler Version 19.10.25019

Sample project:
BetterEnumTest.zip

@aantron
Copy link
Owner

aantron commented Sep 20, 2017

That's not good!

I'm not immediately ready to reproduce this, but thanks for including the project. I'll have to look at it after some delay :/

@Ar5ham
Copy link
Author

Ar5ham commented Sep 20, 2017

That is fine. Please let me know if you need any more info.

@JaapAap
Copy link

JaapAap commented Sep 22, 2017

For some reason, the warning is off by default, see here. You need to add something like
#pragma warning(1 : 4062) to enable it.

@aantron
Copy link
Owner

aantron commented Sep 22, 2017

It seems that this can only be done by the user, so the code proper of Better Enums doesn't need to be modified.

However, we should probably document enabling this warning, perhaps by adding a short sentence and the link given by @JaapAap, to the tutorial and/or reference.

@ikku100
Copy link

ikku100 commented Aug 7, 2018

Yes, please document this issue. I spent 15 minutes trying to get this to fail, then I was about to complain about it and apparently it's a known issue! Imho either change the introduction page to mention that it needs enabling for all those people who are sadly on Visual Studio compilers, or remove the mentioning of the feature. Same for the tutorial page on the switch.

@Ar5ham
Copy link
Author

Ar5ham commented Aug 7, 2018

Enabling that feature is not always an option either, just FYI. Our project uses shared Libs and public headers and when I enabled the feature I also got warning related to Libs and headers that was not ours to begin with. I have picked up a work item to go take a look at how difficult it would be to fix all of them but I suspect it will be a time consuming effort.

@aantron aantron closed this as completed in e5549fb Aug 7, 2018
@aantron
Copy link
Owner

aantron commented Aug 7, 2018

Thanks for pinging. I updated the README and the switch tutorial page with notes about enabling warning C4062 on msvc. I hope that's enough, please let me know/PR if more warnings are needed.

@ikku100
Copy link

ikku100 commented Aug 20, 2018

That's great, thanks Aantron. It's indeed enough.

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

No branches or pull requests

4 participants