标准转换:认证转换 [英] standard conversions:Qualification conversions

查看:100
本文介绍了标准转换:认证转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是ISO的观点:标准转换:数组到指针的转换:$ 4.4:资格转换/第5点

This is the point from ISO :Standard Conversions:Array-to-pointer conversion: $4.4: Qualification conversions /5th point

    A multi-level pointer to member type, or a multi-level mixed pointer and
     pointer to member type has the form:
           cv 0 P 0 to cv 1 P 1 to . . . cv n − 1 P n − 1 to cv n T
    where P i is either a pointer or pointer to member and where T is not a
    pointer type or pointer to member type.

任何人都可以解释这个。如果可能的例子..
任何一个eloborate它?
同样,该节中有不同的形式(资格转换)

Can any one Explain this.If possible give the example .. What actually meant for that form.Can any one eloborate it ? Similarly ..There are different form in that section(Qualification conversions)

推荐答案

/ em>是指向指针的指针。

A multilevel pointer is a pointer to a pointer.

变量可以是 const volatile 通常(这些称为 cv-qualifiers )。当你有一个指针,指向的数据和指针本身可以有cv限定符。当您有多级指针时,可以在任何级别有cv限定符。

Variables can be const or volatile normally (these are called cv-qualifiers). When you have a pointer, both the pointed-to data and the pointer itself can have cv-qualifiers. When you have a multilevel pointer, there can be cv-qualifiers at any level.

例如:

int i1 = 1;
const int i2 = 2;
int * p1 = &i1; // p1 is a non-constant pointer to a non-constant int
int * const p2 = &i1; // p2 is a constant pointer to a non-constant int
int const * p3 = &i2; // p3 is a non-constant pointer to a constant int
const int * p4 = &i2; // same as p3
int const * const p5 = &i2; // p5 is a constant pointer to a constant int
int * * pp1 = &p1; // non-const pointer to non-const pointer to non-const int
int * * const pp2 = &p1; // const pointer to non-const pointer to non-const int
int * const * pp3 = &p2; // non-const pointer to const pointer to non-const int
int const * * pp4 = &p3; // non-const pointer to non-const pointer to const int
// etc.

这篇关于标准转换:认证转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆