|
|
|
|
|
by duped
817 days ago
|
|
That example seems contrived. Why would I want to know something was called n-times? Even for benchmarking I would just capture an integer and increment it. To be mildly pedantic, printing in a destructor is horrible practice because stdout/stderr might be pipes or sockets and writing might fail. It's a really bad idea to do anything in a destructor that effects anything but the class being destroyed for those reasons, and when you get an error, it shows up as an opaque exception or trace or hang at the end of a scope instead of where it actually mattered. |
|