Customize prefix. PCH files in xcode
Luo chaohui (http://www.cnblogs.com/kesalin)
This article follows the "signature-non-commercial use-consistency" creation public agreement
The extension PCH indicates the "precompliled Header", that is, the pre-compiled header file. prefix. PCH is the default pre-compiled header file generated by the xcode project. In this file, we can customize some global macros to facilitate development.
The following post is from
Cocoa is my girlfriendCustomized macros:
# Ifdef debug
# Define Dlog (...) nslog (@ "% S % @", _ pretty_function __, [nsstring stringwithformat :__ va_args _])
# Define Alog (...) [[nsassertionhandler currenthandler] handlefailureinfunction: [nsstring stringwithcstring :__ pretty_function _ encoding: encoding] File: [nsstring stringwithcstring :__ file _ encoding: encoding] linenumber: __line _ description :__ va_args _]
# Else
# Define Dlog (...) do {} while (0)
# Ifndef ns_block_assertions
# Define Ns_block_assertions
# Endif
# Define Alog (...) nslog (@ "% S % @", _ pretty_function __, [nsstring stringwithformat :__ va_args _])
# Endif
# Define Zassert (condition,...) do {If (! (Condition) {alog (_ va_args _) ;}} while (0)
For more information, see the original article. Here I will only describe its usage:
1. In debug modePreprocessor
Set the debug macro in macros;
2. dlog is equivalent to nslog, but only valid in debug mode;
In release mode, it does nothing;
3. alog is short for assert log. In debug mode, it is equivalent to forced
Assert; in release mode, it is equivalent to nslog;
4. zassert is a alog with conditional judgment;
References:
My current prefix. PCH File