Re: xmalloc string functions



Malcolm McLean wrote, On 29/01/08 10:06:

"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.

It did not cause me significant extra work. The most likely reason for the difference is that I designed the entire system knowing that out-of-resource errors *do* occur so it was part of the entire design concept rather than an extra I had to try and fit in.

Oh, and my real-time applications degraded gracefully rather than failing on out-of-time errors as well. Again it was a case of considering how to do the job properly during the design of the application not during coding.

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().

Well, I would not have used your BabyX library anyway, but now I have even more reason to avoid it.

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.

Your knowledge is still faulty.
--
Flash Gordon
.



Relevant Pages

  • Re: xmalloc string functions
    ... out-of-memory errors occur less often than crashes caused ... many applications, ... propagating the error conditions back to the caller. ... So I decided BabyX would use xmalloc. ...
    (comp.lang.c)
  • Re: assign value to field
    ... Set the default value in the table design to Date ... If you get a pop-up after you do that, choose yes to propagating ... skopp wrote: ...
    (microsoft.public.access.gettingstarted)