A clean way to generate custom alerts in cross-platform C code?

Possible duplicate:
user warnings on msvc and gcc?

I am trying to find a relatively clean way to use a preprocessor to create a custom warning message in C code that works for several compilers (MS VC, gcc, AIX, sun, etc.).

I am mainly interested in the warning about obsolete elements, but also for general use.

I know that the Microsoft compiler supports "#pragma debrecated" and "#pragma message", and I used "#warning" on gcc before. I know that "#error" is in the C standard, but I just need a warning. I do not need to stop the compilation process.

I'm starting to realize that every platform has a different way to do this, but does anyone have any better ideas or tips?

+4
source share

Source: https://habr.com/ru/post/1308404/


All Articles