Show where temporary files are created in C ++

What is the fastest way to determine where temporary files are created in my C ++ code?

The answer is not always easily derived from the standard, and optimizing the compiler can further eliminate time constraints.

I experimented with godbolt.org and its fantasy. Unfortunately, he often hides trees behind an assembler tree when it comes to temporary ones. In addition, aggressive compiler optimization options make assembler completely unreadable.

Any other means to achieve this?

+4
source share
2 answers

"optimizing the compiler can further eliminate temporary files."

, ++. ++ . .

. , . , , POD () . . , ctors .

, , . ( std::cout), . , . , .

+4

- "-", , , , .

, ( ), , , , [class.temporary]/2

, . [. :

  • prvalue ([dcl.init.ref], [expr.type.conv], [expr.dynamic.cast], [expr.static.cast], [expr.const.cast], [expr.cast]),

  • prvalue ([expr.ref], [expr.mptr.oper]),

  • prvalue ,

  • std:: initializer_list braced-init-list ([dcl.init.list]),

  • ([expr.typeid], [expr.sizeof])

  • prvalue .

, ++ 17, prvalue [basic.lval]/1:

Prvalue - , - , , .

(pre ++ 20) [basic.lval] [expr], , , .

+2

Source: https://habr.com/ru/post/1692608/


All Articles