I have some objects without names that are created and destroyed with one statement. This minimises the objects lifetime. CPPCheck tells me "Instance of 'xxx' object is destroyed immediately." as a style warning. I see this as good style.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
My objects that are created and destroyed in one statement always do something required and it is often quite a lot. I've found it can be easier to debug when the debugger can use an identifier and there are more statements to put breakpoints on. Your example is probably an exceptional case and it given at C++ Core Guidelines somewhere.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have some objects without names that are created and destroyed with one statement. This minimises the objects lifetime. CPPCheck tells me "Instance of 'xxx' object is destroyed immediately." as a style warning. I see this as good style.
there can be bugs from such mistakes when a name is forgotten for instance:
could you give us some idea about why it's a FP in your case?
My objects that are created and destroyed in one statement always do something required and it is often quite a lot. I've found it can be easier to debug when the debugger can use an identifier and there are more statements to put breakpoints on. Your example is probably an exceptional case and it given at C++ Core Guidelines somewhere.