Creating Custom Flags #warning

I am building a commercial application and we use the GPL code to help us.

How can I add instructions, #warningor #errorso that when creating code for debugging it warns, but when we create for release, it throws errors?

I can do:

#warning this code is released under a CCL licensing scheme, see Source_Code_License.rtf
#warning this code is not LGPL-compliant
#warning this code was copied verbatim from a GP Licensed file

at the beginning of the files, but can I do better? Is there a better way to tag a file if it is included?

I am using Objective-C ++ with gcc or clang.

+3
source share
2 answers

Use #pragma instead.

+2
source
#ifdef SOME_SYMBOL
#error "foobar"
#else
#warning "foobar"
#endif

NDEBUG ( assert) #undef (reincluding assert.h ), , , . .

, #error , #warning .

+4

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


All Articles