Difference between revisions of "Cpp Coding Standards/FIMPL/DefSwitch"

From Apache OpenOffice Wiki
Jump to: navigation, search
 
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
 
==== Special Cases ====  
 
==== Special Cases ====  
In case of switch on an enum, where all enum values are "case"s, it is better to not provide a default switch, because some compilers throw a warning, if one enum value is missing, but does not throw this warning, if a default branch is provided.
+
In case of switch on an enum, where all enum values are "case"s, it is better to not provide a default switch, because some compilers throw a warning, if one enum value is missing, but do not throw this warning, if a default branch is provided.
  
 
In such cases prefer a comment that no default is needed.
 
In such cases prefer a comment that no default is needed.
 +
[[Category:Coding Standards]]

Latest revision as of 17:11, 14 December 2009

Special Cases

In case of switch on an enum, where all enum values are "case"s, it is better to not provide a default switch, because some compilers throw a warning, if one enum value is missing, but do not throw this warning, if a default branch is provided.

In such cases prefer a comment that no default is needed.

Personal tools