开发者

Is there a way to check how a macro "expands" in C or Objective-C

开发者 https://www.devze.com 2023-04-09 06:04 出处:网络
A mac开发者_开发问答ro is a preprocessor right. Sometimes we set things right sometimes we don\'t.

A mac开发者_开发问答ro is a preprocessor right. Sometimes we set things right sometimes we don't.

Wouldn't it be nice to once in a while expand the macro and see how it works?


You can do this with most compilers, e.g. with gcc:

$ gcc -E

this just runs the preprocessor and then stops, giving you the pre-processed output on stdout.

If you're using Xcode though you don't even need to do this - depending on what version of Xcode you're using you can just select Preprocess from the Build menu (that's what its called in Xcode 3.x - if you're using Xcode 4 it may have been moved/renamed). See: Xcode Preprocessor Output

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号