#477: Carpet commit f33caf3aba96 (hg) breaks timer output in CCTK_Terminate ---------------------+------------------------------------------------------ Reporter: rhaas | Owner: eschnett Type: defect | Status: review Priority: major | Milestone: Component: Carpet | Version: Resolution: | Keywords: ---------------------+------------------------------------------------------
Comment (by eschnett):
Strings in C++ are reference counted and have (almost) value semantics, similar to integers. It is very rare to have references to strings; one would use these mostly to return values from a routine. Copying a string is a cheap operation, probably no more expensive than copying a pointer (to the string descriptor) and incrementing a counter (in the string descriptor). This incrementing must be atomic in a multi-threaded environment (such as Carpet), but I still expect a string copy operations to be no more expensive than a few machine instructions.
Regarding the timed-block construct: it is useful to hide these in a macro, similar to loopcontrol or the various BEGIN_REFLEVEL_LOOP constructs. The END_... parts are not strictly necessary -- I added them only for documentation; you could design a timed region without it.