zoukankan      html  css  js  c++  java
  • ios开发之自动引用计数

    没限定:

    - (BOOL)conformsToProtocol:(Protocol *)aProtocol;
    - (BOOL)respondsToSelector:(SEL)aSelector;


    有限定:
    - (id)retain NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
    - (oneway void)release NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
    - (id)autorelease NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
    - (NSUInteger)retainCount NS_AUTOMATED_REFCOUNT_UNAVAILABLE;

    然后是 NS_AUTOMATED_REFCOUNT_UNAVAILABLE 的宏:

    // Marks methods and functions which cannot be used when compiling in automatic reference counting mode.
    #if __has_feature(objc_arc)
    #define NS_AUTOMATED_REFCOUNT_UNAVAILABLE __attribute__((unavailable("not available in automatic reference counting mode")))
    #else
    #define NS_AUTOMATED_REFCOUNT_UNAVAILABLE
    #endif

    这里还有一个 __has_feature( )   简述如下:

    _has_feature and __has_extension
    These function-like macros take a single identifier argument that is the name of a feature. __has_feature evaluates to 1 if the feature is both supported by Clang and standardized in the current language standard or 0 if not (but see below), while __has_extension evaluates to 1 if the feature is supported by Clang in the current language (either as a language extension or a standard language feature) or 0 if not. They can be used like this:

    #ifndef __has_feature         // Optional of course.
      #define __has_feature(x) 0  // Compatibility with non-clang compilers.
    #endif
    #ifndef __has_extension
      #define __has_extension __has_feature // Compatibility with pre-3.0 compilers.
    #endif

    ...
    #if __has_feature(cxx_rvalue_references)
    // This code will only be compiled with the -std=c++11 and -std=gnu++11
    // options, because rvalue references are only standardized in C++11.
    #endif

    #if __has_extension(cxx_rvalue_references)
    // This code will be compiled with the -std=c++11, -std=gnu++11, -std=c++98
    // and -std=gnu++98 options, because rvalue references are supported as a
    // language extension in C++98.
    #endif
    For backwards compatibility reasons, __has_feature can also be used to test for support for non-standardized features, i.e. features not prefixed c_, cxx_ or objc_.

    Another use of __has_feature is to check for compiler features not related to the language standard, such as e.g. AddressSanitizer.

    If the -pedantic-errors option is given, __has_extension is equivalent to __has_feature.

    The feature tag is described along with the language feature below.

    The feature name or extension name can also be specified with a preceding and following __ (double underscore) to avoid interference from a macro with the same name. For instance, __cxx_rvalue_references__ can be used instead of cxx_rvalue_references.

  • 相关阅读:
    【分布计算环境学习笔记】4 Enterprise Java Bean
    超详细的秒杀架构设计,运维,了解一下【转】
    Redis的监控指标【转】
    Windows netstat 查看端口、进程占用 查看进程路径
    wireshark抓包新手使用教程【转】
    关于设置sftp 指定端口【转】
    简单聊一聊Ansible自动化运维【转】
    tomcat启动报错SEVERE: Exception loading sessions from persistent storage【转】
    彻底搞懂 Kubernetes 的底层网络,看这几张图就够了【转】
    Java设计模式之(五)——代理模式
  • 原文地址:https://www.cnblogs.com/xuvw/p/2557334.html
Copyright © 2011-2022 走看看