zoukankan      html  css  js  c++  java
  • When should I use nil and NULL in Objective-C?

    They differ in their types. They're all zero, but NULL is a void *nil is an id, and Nil is a Class pointer.

    各种类型的不存在的表示。

    理解“不存在”的概念不仅仅是一个哲学的问题,也是一个实际的问题。我们是 有形 宇宙的居民,而原因在于逻辑宇宙的存在不确定性。作为一个逻辑系统的物理体现,电脑面临一个棘手的问题,就是如何用 存在 表达 不存在 .

    在 Objective-C 中,有几个不同种类的 不存在。

    They both are just typecast zero's. Functionally, there's no difference between them. ie.,

    #define NULL ((void*)0)
    #define nil ((id)0)

    There is a difference, but only to yourself and other humans that read the code, the compiler doesn't care.

    One more thing nil is an object value while NULL is a generic pointer value.

    https://stackoverflow.com/questions/1564410/when-should-i-use-nil-and-null-in-objective-c

  • 相关阅读:
    SetTransform
    D3DXCreateText
    《高级游戏特性实现》考试样题
    KeyUp
    .FX File
    CMD
    X File Class
    《DirectX游戏设计》考试样题
    ps图片处理效果——很nice哦
    学习篇:来点水货要天天学习!!!
  • 原文地址:https://www.cnblogs.com/feng9exe/p/12746466.html
Copyright © 2011-2022 走看看