What are deprecated enum types?
The terminology is ambiguous, but implies some specific enum types have been marked as deprecated using either:
a compiler-specific notation, such that there will be a warning or error if they're used, and/or
documentation without any technical enforcement (whether e.g. a sweeping corporate "coding standard" requiring that say only C++11 enum classes be used, or an API-specific note that specific enum types are deprecated)
What deprecated means?
That the functionality may be removed in a later version of the system, usually because it is considered inferior (whether to some existing alternative, or in terms of maintainability, performance, robustness etc.) or unimportant.
How they are declared, or discovered?
If the deprecation is being enforced by the compiler, then it will be have to be included in the same translation unit as the enum
type: it may be in the same header, or in a general "deprecation.h" header etc.. Here's a few examples for a common compiler:
How should they be handled, (or not)
When you can, you should investigate why they're deprecated and what the alternatives are, and change the code using them to avoid them.
What problems they can cause?
The immediate problem they cause is that your compiler may generate warnings or errors.
They may well be deprecated because it's not the best idea to use them even with the current software - related functionality may be inefficient, buggy, etc.. For example, given enum Image_Format { GIF, PNG, JPEG, SVG };
, GIF
may be deprecated in a system because PNG has proven better for the system's users - e.g. perhaps because it supports better colour depth, preserving the colours more accurately, or SVG
might be deprecated because some clients have been found to be using web browsers that won't display them, JPEG
might be deprecated because it's known the images in the system aren't natural photographic images and the format gives visually poor results despite larger compressed files, slower processing speed and higher memory usage - lots of possible motivations for making things deprecated.
A bigger but not immediate issue is that they could disappear with the next revision of the software "subsystem" providing them, so if you don't migrate old code off them and avoid creating new code using them, your software will have to be fixed before it can work with the update to that subsystem.