以下代码是否合法? [英] Is the following code legal?

查看:64
本文介绍了以下代码是否合法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

#include< new>


class T

{

};


int main()

{

T t = t;

T u(u);

T v;

new(& v)T(v);

}


Kiuhnm

#include <new>

class T
{
};

int main()
{
T t = t;
T u(u);
T v;
new (&v) T(v);
}

Kiuhnm

推荐答案

Kiuhnm写道:
#include< new>

class T
{
};

int main()
{t / t; t t(t);
T v;
new(& v)T(v);
}

Kiuhnm
#include <new>

class T
{
};

int main()
{
T t = t;
T u(u);
T v;
new (&v) T(v);
}

Kiuhnm




您是否尝试过编译?


编译器是否给你错误?


为什么你认为那是?


什么你期待每一行吗?


Ben Pope

-

我不只是一个号码。对很多人来说,我被称为字符串...



Have you tried compiling this?

Does you compiler give you errors?

Why do you think that is?

What do you expect each line to do?

Ben Pope
--
I''m not just a number. To many, I''m known as a string...


Ben Pope ha scritto:
Ben Pope ha scritto:
你试过编译吗?


是的,但这无关紧要。我怎么能确定我的编译器是完全符合标准的


你期望每行做什么?
Have you tried compiling this?
Yes, but it is irrelevant. How can I be sure that my compiler is
completely standard-compliant?
What do you expect each line to do?



这是无关紧要的。

我想知道的是,根据标准,代码是否会产生定义的行为。


Kiuhnm



It is irrelevant.
All I would like to know is whether the code, according to the standard,
produces a defined behavior or not.

Kiuhnm


Kiuhnm写道:
Kiuhnm wrote:
Ben Pope ha scritto:
Ben Pope ha scritto:
你试过编译吗?



是的,但这是无关紧要的。我怎么能确定我的编译器完全符合标准?



Yes, but it is irrelevant. How can I be sure that my compiler is
completely standard-compliant?




你不能。



You can''t.

你期望每一行做什么?



这是无关紧要的。
所有我想知道的是代码,根据标准,
产生或不产生定义的行为。



It is irrelevant.
All I would like to know is whether the code, according to the standard,
produces a defined behavior or not.




不。



Not.


这篇关于以下代码是否合法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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