Is there a way to test how a macro expands to C or Objective-C

A macro is a preprocessor. Sometimes we set things right, sometimes we do not.

Would it be nice to expand the macro from time to time and see how it works?

+6
source share
1 answer

You can do this with most compilers, for example. with gcc:

$ gcc -E 

it just starts the preprocessor and then stops, providing you with preprocessed output on stdout.

If you use Xcode, although you don’t even need to do this - depending on which version of Xcode you are using, you can just select Preprocess from the Build menu (which caused it in Xcode 3.x - if you use Xcode 4, maybe it has been moved / renamed). See: Xcode Preprocessor Output

+11
source

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


All Articles