When using sprintf, the compiler warns me that the function is deprecated.
How can I show my own compiler warning?
Although there is no standard #warning directice, many compilers (including GCC, VC, Intels and Apples), support #warning message.
#warning "this is deprecated"
Often it is better to not only bring up a warning (which people can overlook), but to let compiling fail completely, using the #error directive (which is standard):
#if !defined(FOO) && !defined(BAR)
# error "you have neither foo nor bar set up"
#endif