[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Custom extensions to Lua
- From: Glenn Maynard <glenn@...>
- Date: Wed, 10 Aug 2005 19:17:14 -0400
On Thu, Aug 11, 2005 at 12:02:36AM +0100, David Given wrote:
> It uses exceptions extensively in order to communicate error states. Yes,
> they're not cheap in terms of code size, but used properly they can *vastly*
> simplify your logic flow. Another thing I was doing was never dynamically
> allocating anything if I could possibly help it; I think I use the new
> operator once in the entire program. (Although I do use STL containers quite
> a lot.) Since C++ exceptions call destructors, this means that all my memory
> allocation problems basically go away.
Turning off exceptions cut a 7 meg program down to 5 megs with g++, and a
4 meg program down to ~3.5 with VC. (Numbers aren't exact--tests were over
a year ago--but the order of magnitude is correct.) That's just too much,
in my opinion. I'm developing for memory-limited environments (not 128k
embedded, but not half-gig-desktop, either: two megs matters), which influences
my outlook, but I wouldn't enjoy all code on my workstation being 20% bigger,
either.
--
Glenn Maynard