Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!brunix!!sdm From: sdm@cs.brown.edu (Scott Meyers) Newsgroups: comp.lang.c++ Subject: Re: C++ coding standards (Comment needed) Message-ID: <48145@brunix.UUCP> Date: 24 Aug 90 16:31:22 GMT References: <883@zinn.MV.COM> Sender: news@brunix.UUCP Reply-To: sdm@cs.brown.edu (Scott Meyers) Organization: Brown University Department of Computer Science Lines: 22 In article <883@zinn.MV.COM> mjv@objects.mv.com (Michael J. Vilot) writes: | I sometimes use objects of classes that only provide constructors and | destructors. I use them only for their side-effects. Here's a simple | example: ... | { | Timer t; | | // do some timed work, and report the time at block exit | } ... | The Timer object `t' is only active in the inner block. Of course, the | object is apparently never used, so I may get into trouble with those | building aggressively-optimizing compilers. | | I hope such optimizations allow this use of constructor/destructor | side-effects. This doesn't even always work in cfront 2.0, as I found out recently when I tried implementing a class to automate routine tracing. Scott