//
// main.m
// 预定义
//
// Created by wu jianhua on 16-8-3.
// Copyright (c) 2016年 wujianhua. All rights reserved.
//
#import <Foundation/Foundation.h>
#define message_for(a, b) NSLog(@#a " and " #b ": We love you!")
#define tokenpaster(n) NSLog (@"token" #n " = %d", token##n)
#if !defined (MESSAGE)
#define MESSAGE "You wish!"
#endif
//参数化宏
#define MAX(x,y) ((x) > (y) ? (x) : (y))
typedef unsigned char BYTE;
#define TRUE 1
#define FALSE 0
#define DEBUG 0
#if DEBUG == 0
#define DebugLog(...)
#elif DEBUG == 1
#define DebugLog(...) NSLog(__VA_ARGS__)
#endif
//http://www.yiibai.com/objective_c/objective_c_preprocessors.html
int main(int argc, const char * argv[])
{
NSLog(@"File :%s ", __FILE__ );
NSLog(@"Date :%s ", __DATE__ );
NSLog(@"Time :%s ", __TIME__ );
NSLog(@"Line :%d ", __LINE__ );
NSLog(@"ANSI :%d ", __STDC__ );
message_for(Carole, Debra);
int token110=1024;
tokenpaster(110);
NSLog(@"Here is the message: %s", MESSAGE);
NSLog( @"Value of TRUE : %d", TRUE);
NSLog( @"Value of FALSE : %d ", FALSE);
DebugLog(@"Debug log, our custom addition gets printed during debug only" );
NSLog(@"NSLog gets printed always" );
//类型转换
int sum = 17, count = 5;
CGFloat mean;
mean = (CGFloat) sum / count;
NSLog(@"Value of mean : %f", mean );
return 0;
}
objective-c之预定义
最新推荐文章于 2017-07-05 16:59:53 发布

187

被折叠的 条评论
为什么被折叠?



