zoukankan      html  css  js  c++  java
  • Understanding-and-Using-C-pointers

    #### Why You Should Become Proficient with Pointers

    指针的几个用处:

    * Creating fast and efficient code
    * Providing a convenient means for addressing many types of problems
    * Supporting dynamic memory allocation
    * Making expressions compact and succinct
    * Providing the ability to pass data structures by pointer without incurring a large overhead
    * Protecting data passed as a parameter to a function

    指针可能出现的几个问题:

    * 访问数组和其他数据结构越界
    * 引用已经不错在的自动变量
    * 在对内容被释放后引用堆内存
    * 在指针被分配内存前解引用

    pointer的语法和语义都由C specification定义,但有些情况没有显示定义,这种情况下,行为被定义为:

    * Implementation-defined
    * Unspecified
    * Undefined

    #### Declaring Pointers

    #### How to Read a Declaration

    **The trick is to read them backward.**

    #### Address of Operator

    good practice: initialize a pointer as soon as possible

    #### The Concept of Null

    几个Null:

    * The null concept
    * The null pointer constant
    * The NULL macro
    * The ASCII NUL
    * A null string
    * The null statement

    当NULL被赋值给指针时,意味着这个指针不指向任何东西。

    null pointer与未初始化pointer不一样:后者可能包含任何值,前者不指向任何内存位置。

    #### To NULL or not to NULL

    zero的意义随着上下文而改变。

    收刀入鞘吧!凡动刀的,必死在刀下!
  • 相关阅读:
    JMeter的JavaRequest探究
    记一次生产压测遇到的"坑"
    JMeter之If Controller深究二
    JMeter之SteppingShape
    那些年拿过的shell之adminer
    Spring Boot Actuator H2 RCE复现
    使用sqlmap结合dnslog快速注入
    一次稍显曲折的爆破经历
    无回显、不出网命令执行测试方式
    实战绕过某waf后缀检测内容检测
  • 原文地址:https://www.cnblogs.com/qiuyi116/p/9008852.html
Copyright © 2011-2022 走看看