Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

remark #383: value copied to temporary, reference to temporary used

r4dium
Beginner
978 Views
I have the following lines of code in my sourcefiles:

Regions.push_back(tuple(0.95, 1.0));

this->cStream_Frame_Duration.push_back(0);

this->cStream_Number_of_Keyframes.push_back(0);

this->cpLast_Frames.push_back ( NULL );

Those are vectors from a STL implementation on which push_back() is performed.

On all lines the following remark appears:

remark #383: value copied to temporary, reference to temporary used

How can I change the code so that the remark doesn't appear?

What causes the remark to appear?

Regards

R4DIUM
0 Kudos
1 Solution
JenniferJ
Moderator
978 Views
Yeh, in this case vector::push_back(const T& in), it's not important. Compiler should know that "&in" is not saved anywhere.
We're working on to reduce this type of warning/remarks. This remark is on the list. Once the compiler is ready, I should post a news here.
Thanks!

View solution in original post

0 Kudos
5 Replies
JenniferJ
Moderator
978 Views

It's because compiler has to generate objects for those parameters:

tuple(0.95, 1.0));
0
NULL

if this->cpLast_Frames is "vector", you won't see this warning.

0 Kudos
r4dium
Beginner
978 Views

It's because compiler has to generate objects for those parameters:

tuple(0.95, 1.0));
0
NULL

if this->cpLast_Frames is "vector", you won't see this warning.

And why is this important?

Is it because the created objects had a short constructor lifetime in old compilers and

were destroyed even if they were referenced by a internal class reference?

http://h21007.www2.hp.com/portal/site/dspp/menuitem.863c3e4cbcdc3f3515b49c108973a801/?ciid=2708d7c682f02110d7c682f02110275d6e10RCRD

under

ISO-28. Temporary used to init reference not an error (No diagnostic in aCC6)

Regards R4DIUM

0 Kudos
JenniferJ
Moderator
979 Views
Yeh, in this case vector::push_back(const T& in), it's not important. Compiler should know that "&in" is not saved anywhere.
We're working on to reduce this type of warning/remarks. This remark is on the list. Once the compiler is ready, I should post a news here.
Thanks!
0 Kudos
mfactor
Beginner
978 Views
Hello,

Could this remark be caused by a real() call to a complex value?

Thanks
0 Kudos
JenniferJ
Moderator
978 Views
Quoting - mfactor
Hello,
Could this remark be caused by a real() call to a complex value?

Thanks
Could you copy some code snipet?


Hello all,
this remark is disabled in 11.1. you can only see it with /W5

Jennifer
0 Kudos
Reply