lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wed, Aug 10, 2005 at 04:27:05PM -0500, Rici Lake wrote:
> You could say the same thing about exceptions, really. Why should the 
> compiler provide specific support when it could be achieved in the 
> standard library (with setjmp and friends)?

Destructors need to be called, and setjmp() can't do that.

(setjmp is evil, but so are C++ exceptions, at least in practice: they
bloat binaries far more than their value, in my opinion.  I tend to
stick to old-fashioned error returns.)

> >You can't forget anything if you use a template type that doesn't 
> >initialize
> >from a pointer:
> >
> >  locked<int> value = 1;
> >  value = 2;
> 
> Yes, again. In which case, the use of the synchronized attribute would 
> have been precisely equivalent, aside from the issue of whether it 
> should be in the compiler, in a standard template library, or even 
> implemented with a preprocessor.

Yep; I was responding to the suggestion that this approach is less safe
because you can "forget" things.

-- 
Glenn Maynard