c++ - Print out a static "deprecate" warning message with a suggested correction when an particular enum identifier is used? -
in c++ library used in many places in our collaboration, have mistakenly defined multiple enums in same lib namespace define constant values. enum distinct type not distinct namespace. consequence enum values end in same namespace. open door enum identifier collision , inconvenient when using automatic completion. in order solve considering moving different enums in distinct namespaces.
to easy evolution of code using library able display @ compile time "deprecate" warning message suggesting code change when old enum identifiers met in code.
the following question , answers does there exist static_warning? provide way define deprecate warning when condition met. how achieve same effect when enum identifier shows in user code ?
if use visual c++ might able use #pragma deprecated
.
for gcc there __attribute__
compiler extension, might used mark variables or functions deprecated. don't know enumerations though.
Comments
Post a Comment