4 ms·
How about this: #define NOTNULL void foo(NOTNULL char *bar) If you're using Objective-C, then nonnull is your friend.
by saagarjha 8y ago
How about this:
#define NOTNULL
void foo(NOTNULL char *bar)
If you're using Objective-C, then nonnull is your friend.
- int_19h 8y agoThe point is to get [static 1] in the expansion of the macro, so that the compiler is aware too, not just the coder.
- saagarjha 8y agoAh. I was wondering why this was difficult; thanks for the clarification!
- 1over137 8y agoThe clang nullability annotations can be used in C/C++ as extensions: https://clang.llvm.org/docs/AttributeReference.html#nullability-attributes https://clang.llvm.org/docs/AttributeReference.html#nullabil... You could then conditionally define your NOTNULL using them or not. The compiler will then complain about incorrect usage.