[ 
https://issues.apache.org/jira/browse/MESOS-2664?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14599623#comment-14599623
 ] 

Michael Park commented on MESOS-2664:
-------------------------------------

[~bmahler] I think {{-Wswitch}} _almost_ captures what we want.

Yes, to both (a) and (b). The missing part for {{-Wswitch}} for us is: (c) If 
we covered all the cases *and* have a {{default}}, it would be nice for that to 
also be a warning. When we add a new enum case, I think what we want is a 
warning saying "you need to handle this new enum value here!" rather than 
silently going into the {{default}} case. An example from our codebase:

{code}
switch (volume.mode()) {
  case Volume::RW: volumeConfig += ":rw"; break;
  case Volume::RO: volumeConfig += ":ro"; break;
  default:
    LOG(FATAL) << "Unknown Volume mode: " << volume.mode();
    break;
}
{code}

I think we can capture what we want with {{-Wswitch}} + a style guide around 
the use {{default}}. What do you think?

P.S. We currently have {{-Wall}} turned on, which includes {{-Wswitch}} :)

> Modernize the codebase to C++11
> -------------------------------
>
>                 Key: MESOS-2664
>                 URL: https://issues.apache.org/jira/browse/MESOS-2664
>             Project: Mesos
>          Issue Type: Epic
>          Components: technical debt
>            Reporter: Michael Park
>            Assignee: Michael Park
>              Labels: mesosphere
>
> Since [this 
> commit|https://github.com/apache/mesos/commit/0f5c78fad3423181f7227027eb42d162811514e7],
>  we officially require GCC-4.8+ and Clang-3.5+. This means that we now have 
> full C++11 support and therefore can start to modernize our codebase to be 
> more readable, safer and efficient!



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to