__file__
directory where the current file is located
__date__
"Alternate text" is a string literal with a compile date formatted as "MM DD yyyy" (For example: "Mar 19 2006"). If the date is less than 10th, a space character is placed in front of the day. NSLog (@ "_date_=%s", __date__);
__function__ Current function name __line__ the number of lines in the source file for the current statement __time__
This string literal contains the compile time in the format "HH:MM:SS" (Example: "08:00:59"). __stdc__
An integer constant of 1, which indicates that this compiler follows the ISOC standard. __stdc_version__ How to implement composite C89 full 1, the value of this macro is 19940SL, if the implementation conforms to C99, then the value of this macro is 199901L; otherwise the value is undefined __stdc_eobted__ (C 99) Implementation for the host when implemented as 1, implemented as a standalone implementation of 0
__stdc_iec_559__ (C99) floating point number to achieve composite IBC 60559 standard when defined as 1, no value is undefined
__STDC_IEC_559_COMPLEX__ (C99) complex operation to achieve composite IBC 60559 standard when defined as 1, no value is undefined
__STDC_ISO_10646__ (C99) is defined as a long integer constant, YYYYMML represents the wchar_t value of the composite ISO 10646 standard and its specified revision supplement, otherwise the value is undefined
1. When release, block log
C code
- #if defined (Debug) && debug = = 1
- #else
- #define NSLOG (...) {};
- #endif
2. Block is executed in the main thread or in the background
C code
- #define BACK (block) Dispatch_async (dispatch_get_global_queue (dispatch_queue_priority_default, 0), block)
- #define MAIN (Block) Dispatch_async (Dispatch_get_main_queue (), block)
3. Equipment related
C code
- #define Isretina ([UIScreen instancesrespondtoselector: @selector (currentmode)]? Cgsizeequaltosize (Cgsizemake (640, 960), [[UIScreen Mainscreen] currentmode].size): NO)
- #define IPHONE5 ([UIScreen instancesrespondtoselector: @selector (currentmode)]? Cgsizeequaltosize (Cgsizemake (640, 1136), [[UIScreen Mainscreen] currentmode].size): NO)
- #define ISPAD (ui_user_interface_idiom () = = Uiuserinterfaceidiompad)
- #define Currentsystemversion ([[Uidevice Currentdevice] systemversion])
- #define CURRENTLANGUAGE ([[Nslocale preferredlanguages] objectatindex:0])
4. Distinguish between simulator and real machine
C code
- #if Target_os_iphone
- IPhone Device
- #endif
- #if Target_iphone_simulator
- IPhone Simulator
- #endif
5, depending on whether to use ARC to do different operation
C code
- #if __has_feature (OBJC_ARC)
- Compiling with ARC
- #else
- Compiling without ARC
- #endif
----Common macro definitions and explanations for iOS development