Re: xmalloc string functions




"Flash Gordon" <spam@xxxxxxxxxxxxxxxxxx> wrote in message
Not always. I've done it using structured programming in assembler without implementing exceptions and at each point I checked the status and propagated the error until it could be handled. The handling consisted of processing what it had memory for giving degraded performance instead of giving up which would not have been acceptable. It was also easy to do because I new resources were limited and designed the SW assuming that they could run out.

I've done this as well. It was adding so much complexity to code, all because of allocation failures that couldn't happen. Finally, within BabyX (my X windows toolkit) there was no way I could think of of propagating the error conditions back to the caller. Flow control is just too complex with the whole thign beign held together by a newtwork of function pointers. So I decided BabyX would use xmalloc().
Then I realised that this released something for string handling. because we know that those string functions can never return null, code using them is so much more expressive and flexible.

--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm

.