zoukankan      html  css  js  c++  java
  • Objective-C 源码初探 __attribute__

    #import <Foundation/Foundation.h>
    
    //延迟执行,delayFunc函数即为延迟执行的函数
    #define onExit
        __strong void (^block)() __attribute__((cleanup(delayFunc),unused)) = ^
    
    void delayFunc(__strong void (^*block)()){
        (*block)();
    }
    
    //在main函数执行之前执行的函数
    __attribute__((constructor)) void ExecuteBefore_main(){
        printf("ExecuteBefore_main
    ");
    }
    
    __attribute__((destructor)) void ExecuteAfter_main(){
        printf("ExecuteAfter_main
    ");
    }
    
    //函数可用性
    void functionDeprecatedAndObsoleteWarningAndError() __attribute__ ((availability(macosx,introduced=10.4,deprecated=10.10,obsoleted=10.13)));
    
    void functionDeprecatedAndObsoleteWarningAndError(void){
        
    }
    
    //返回值未使用
    int returnValueNotUnusedWarning() __attribute__ ((warn_unused_result));
    
    int returnValueNotUnusedWarning(){
        return 1;
    }
    
    int main(int argc, const char * argv[]) {
        @autoreleasepool {
            
            printf("Hello, World!
    ");
            
            functionDeprecatedAndObsoleteWarningAndError();
            returnValueNotUnusedWarning();
            onExit{
                printf("onExit
    ");
            };
        }
        return 0;
    }
  • 相关阅读:
    JavaScript将数字转换为大写金额
    css浮动
    JS合并数组的几种方法及优劣比较
    jquery.zclip.js粘贴功能
    iframe获取元素
    某些框架,类库
    web前端基础知识!
    前端开发流程
    学习其他前端技术
    SVN的学习以及使用!
  • 原文地址:https://www.cnblogs.com/ficow/p/5631461.html
Copyright © 2011-2022 走看看