| |

VerySource

 Forgot password?
 Register
Search
Author: 格里弗斯

Quotes and continuous assignments, thank you!

[Copy link]

1

Threads

8

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 Invalid IP Address

 Author| Post time: 2020-1-11 20:18:01
| Show all posts
Does anyone help?
Reply

Use magic Report

2

Threads

54

Posts

34.00

Credits

Newbie

Rank: 1

Credits
34.00

 China

Post time: 2020-3-20 21:15:01
| Show all posts
According to the situation of this test (d = e), the return value does not seem to be a const temporary object. In theory, it should be. Is this something related to the compiler, waiting for expert advice?
up
Reply

Use magic Report

0

Threads

73

Posts

46.00

Credits

Newbie

Rank: 1

Credits
46.00

 Invalid IP Address

Post time: 2020-3-22 08:30:01
| Show all posts
What compiler do you use?
Why even use VC2003 and g ++ to test your code, there are no problems, all three 98 (regardless of returning reference or non-reference).
Reply

Use magic Report

1

Threads

39

Posts

27.00

Credits

Newbie

Rank: 1

Credits
27.00

 China

Post time: 2020-4-10 21:15:01
| Show all posts
Temporary variables say "temporary", which is the concept of time (scope) and does not specify what type it is.
It's just that built-in types, by default, are not addressable, and at the same time they cannot be modified. There is no exact type
Can represent this (non-addressable concept).

I feel that this code should be no problem, if any, it is all a matter of order of expressions.
But it stands to reason that it should be a = (b = c) first. It's just that the expressions of c ++ are sometimes really not common sense to explain.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list