由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - 请教问题(想糊涂了) new int; new int();
相关主题
const objectC++问题,confusing...
请教几个C++问题C++里面
请教个Bloomberg 的 C++ 题目C++ questions
c++ questionone question about struct
what is the difference?C++: exception: out-of-order execution?
C++ 中 myobject * a =new myobject[n] 的问题[合集] 关于C++ default copy constructor
Test your C++ knowledge...抠字眼:assignment and initialize in C++
Re: 110道C++面试题目,你会做多少? (转载)An empty C structure Question
相关话题的讨论汇总
话题: int话题: new话题: 糊涂话题: see话题: 区别
进入Programming版参与讨论
1 (共1页)
b*****d
发帖数: 23
1
int *p = new int;
int *q = new int();
这两个有啥区别? 为什么?
A* pp = new A;
A* qq = new A();
为什么这两个就没区别了呢?
糊涂了。。。请大牛指教。
t****t
发帖数: 6806
2
int *p=new int; // *p is indeterminated
int *q=new int(); // *q is 0
for (class type) A, A has constructor, it is called anyway, so there's no
difference.
See C++ Standard 5.3.4, Clause 15.

【在 b*****d 的大作中提到】
: int *p = new int;
: int *q = new int();
: 这两个有啥区别? 为什么?
: A* pp = new A;
: A* qq = new A();
: 为什么这两个就没区别了呢?
: 糊涂了。。。请大牛指教。

c**a
发帖数: 316
3
I see.
谢谢大牛。

【在 t****t 的大作中提到】
: int *p=new int; // *p is indeterminated
: int *q=new int(); // *q is 0
: for (class type) A, A has constructor, it is called anyway, so there's no
: difference.
: See C++ Standard 5.3.4, Clause 15.

1 (共1页)
进入Programming版参与讨论
相关主题
An empty C structure Questionwhat is the difference?
copy constructor问题。C++ 中 myobject * a =new myobject[n] 的问题
[合集] C++问题(copy constructor)Test your C++ knowledge...
[合集] can C++ constructor be private? the answer is YES!Re: 110道C++面试题目,你会做多少? (转载)
const objectC++问题,confusing...
请教几个C++问题C++里面
请教个Bloomberg 的 C++ 题目C++ questions
c++ questionone question about struct
相关话题的讨论汇总
话题: int话题: new话题: 糊涂话题: see话题: 区别