Re: General rules on interface (function) design



Eric Sosman wrote:

.... snip ...

The original suggestion in this thread was that "local"
functions should not as a rule allocate dynamic memory. I'm
still unsure what "local" is supposed to mean, but does anyone
think it a bad idea for fopen() to call malloc()?

I certainly hope not. I suspect the OP considers statid functions
to be 'local' functions. At any rate I see no problem with such
animals calling malloc and friends, as long as they are clearly
documented as requiring an eventual free, or corresponding release
call. The latter may be necessary for things that have internal
levels, such as structures with pointers to strings.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>


.



Relevant Pages

  • Re: Cards Class
    ... but I'm unsure how to integrate this into ... This is very concise code, maybe even bad for readability, but worth ...
    (comp.lang.ruby)
  • Re: powerplug networking
    ... a new Apple TV device I have ordered. ... I have wireless G and am unsure if ...
    (uk.comp.sys.mac)
  • Re: General rules on interface (function) design
    ... Eric Sosman wrote ... functions should not as a rule allocate dynamic memory. ... still unsure what "local" is supposed to mean, ... errno for any of the errors specified for the routine malloc. ...
    (comp.lang.c)
  • Re: change the numbers language
    ... Now, I'm unsure whether you will read that with full comprehension, so ... register; ...
    (microsoft.public.mac.office.word)
  • Re: Crap! Now The Water Heater Is Going Bad!
    ... > new heater but am still unsure how I will manage to run a drain from ... > John McGaw ...
    (alt.home.repair)