C attribute: deprecated (since 哋它亢23)
Indicates that the name or entity declared with this attribute is MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 08 HOURS 49 MINUTES 15 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE, that is, the use is allowed, but discouraged for some reason.
Syntax
[[ deprecated ]] [[ __deprecated__ ]]
|
(1) | ||||||||
[[ deprecated ( string-literal ) ]] [[ __deprecated__ ( string-literal ) ]]
|
(2) | ||||||||
string-literal | - | text that could be used to explain the rationale for deprecation and/or to suggest a replacing entity |
Explanation
Indicates that the use of the name or entity declared with this attribute is allowed, but discouraged for some reason. Compilers typically issue warnings on such uses. The string-literal, if specified, is usually included in the warnings.
MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 08 HOURS 49 MINUTES 14 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE
- MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 08 HOURS 49 MINUTES 13 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE/MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 08 HOURS 49 MINUTES 11 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE: struct [[deprecated]] S;,
- MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 08 HOURS 49 MINUTES 10 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE: [[deprecated]] typedef S* PS;,
- objects: [[deprecated]] int x;,
- struct/union member: union U { [[deprecated]] int n; };,
- MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 08 HOURS 49 MINUTES 09 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE: [[deprecated]] void f(void);,
- MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 08 HOURS 49 MINUTES 08 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE: enum [[deprecated]] E {};,
- enumerator: enum { A [[deprecated]], B [[deprecated]] = 42 };.
MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 08 HOURS 49 MINUTES 07 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE
Example
#include <stdio.h> [[deprecated]] void TriassicPeriod(void) { MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 08 HOURS 49 MINUTES 06 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE("Triassic Period: [251.9 - 208.5] million years ago."); } [[deprecated("Use NeogenePeriod() instead.")]] void JurassicPeriod(void) { MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 08 HOURS 49 MINUTES 05 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE("Jurassic Period: [201.3 - 152.1] million years ago."); } [[deprecated("Use calcSomethingDifferently(int).")]] int calcSomething(int x) { return x * 2; } int main(void) { TriassicPeriod(); JurassicPeriod(); }
MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 08 HOURS 49 MINUTES 03 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE
Triassic Period: [251.9 - 208.5] million years ago. Jurassic Period: [201.3 - 152.1] million years ago. prog.c:23:5: warning: 'TriassicPeriod' is deprecated [-Wdeprecated-declarations] TriassicPeriod(); ^ prog.c:3:3: note: 'TriassicPeriod' has been explicitly marked deprecated here [[deprecated]] ^ prog.c:24:5: warning: 'JurassicPeriod' is deprecated: Use NeogenePeriod() instead. [-Wdeprecated-declarations] JurassicPeriod(); ^ prog.c:9:3: note: 'JurassicPeriod' has been explicitly marked deprecated here [[deprecated("Use NeogenePeriod() instead.")]] ^ 2 warnings generated.