I know you can mark a single constant as deprecated using
const
NotDeprConst1 = 1;
DeprConst = 2 deprecated;
NotDeprConst2 = 2;
But, can you mark a whole const block as deprecated without marking the constants one by one?
I would like to do something like:
const deprecated
DeprConst1 = 1;
DeprConst2 = 2;
DeprConst3 = 3;
That doesn't compile however (the compiler sees "deprecated" as a identifier).
Or maybe there's a compiler directive:
{$DEPRECATED ON}
const
DeprConst1 = 1;
DeprConst2 = 2;
DeprConst3 = 3;
{$DEPRECATED OFF}
Embarcadero's hinting directives documentation says you can mark any declaration with a hint (like deprecated) but doesn't elaborate.
const deprecated N = 42;
violates pascal grammar rules. Documentation is pretty clear about what you mark a declaration with hint directive. When you declare three constants you have to use directive on each declaration. There is no real solution for your problem. As yet another semi-solution you could convert constants to enumerated type and deprecate that type. – Charmaincharmaine