difference between “ifndef” and “if !defined” in C?

No, there’s no difference between the two when used that way. The latter form (using defined()) is useful when the initial #if or one of the subsequent #elif conditions needs a more complex test. #ifdef will still work, but it might be clearer using #if defined() in that case. For example, if it needs to test if more than one macro is defined, or if it equals a specific value.

The variance (using both in a file) could depend on specific subtleties in usage, as mentioned above, or just poor practice, by being inconsistent.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)