Message338731
Switches from #define's to an enum would allow explictly deprecating the old name (at least with clang and probably with GCC as well):
clang -c -Wall t.c
t.c:12:10: warning: 'READONLY' is deprecated: use PY_READONLY [-Wdeprecated-declarations]
int i = READONLY;
^
t.c:7:26: note: 'READONLY' has been explicitly marked deprecated here
READONLY __attribute__((deprecated("use PY_READONLY"))) = PY_READONLY
^
1 warning generated.
For this source code:
#include <stdio.h>
enum {
PY_READWRITE = 0,
PY_READONLY = 1,
READONLY __attribute__((deprecated("use PY_READONLY"))) = PY_READONLY
};
int main(void)
{
int i = READONLY;
printf("%d\n", i);
return 0;
}
I'm not sure if it worthwhile switch to an enum here, the CPython source code isn't consistent in using enums for constants like this. |
|
| Date |
User |
Action |
Args |
| 2019-03-24 13:03:09 | ronaldoussoren | set | recipients:
+ ronaldoussoren, serhiy.storchaka, matrixise, josh.r |
| 2019-03-24 13:03:09 | ronaldoussoren | set | messageid: <[email protected]> |
| 2019-03-24 13:03:09 | ronaldoussoren | link | issue36347 messages |
| 2019-03-24 13:03:09 | ronaldoussoren | create | |
|