Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Beginner
79 Views

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

Jump to solution
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

Accepted Solutions
Moderator
79 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
Moderator
79 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
Beginner
79 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=2708d7c68...

under

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

Regards R4DIUM

0 Kudos
Moderator
80 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
Beginner
79 Views
Hello,

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

Thanks
0 Kudos
Moderator
79 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