Re: New Rule Suggestion



Hi Dennis,

> I would like us to discuss a new rule.
>
> "A function returning a string as result must allocate enough memory
for
> that string and not more"
>
> I think that is a bad idead to allocate to much memory for strings and
just
> setting the Length variable short.

Borland votes "No" (see NewAnsiString).

This function rounds size up to full word.

My new UpperCase & LowerCase functions
round size up to full dword.

Is there big differnce?
There is no difference, because all existing MMs
allocate memory by dwords.

--
regards
Aleksandr


.



Relevant Pages

  • Re: Blowfish encryption
    ... the source string will be padded to the next ... correct for Harbour/HWGUI but for good old 16 bit Clipper it ... allocate up to 64K, so any data/field longer than this will fail. ... an unrecoverable error 5304 (conventional memory exhausted). ...
    (comp.lang.clipper)
  • Re: Function speed, which is fast
    ... what is happening is the string is getting resized and memory allocation ... or you could create a dynamic memory chuck pointed via a PCHAR.. ... allocate like a 100K byte Pchar buffer. ... > function examines every single character of the plain text file. ...
    (comp.lang.pascal.delphi.misc)
  • Re: This is getting really weird.
    ... I thought 4 bytes for reference count and 4 for string length. ... > There should be no memory allocation for that line. ... > manager may allocate more space than requested for its own efficiency. ... > that New returned with a pointer to the string constant. ...
    (alt.comp.lang.borland-delphi)
  • Re: Unknown Crashing...
    ... each) and allocate that much memory. ... if the string given for Station is sizeofor more ... This copies the string from the Station array to itself. ...
    (comp.lang.c.moderated)
  • Re: This is getting really weird.
    ... > You say, one has to allocate a string, ok I do that like so: ... There should be no memory allocation for that line. ... manager may allocate more space than requested for its own efficiency. ... pointer to that heap space in Storage. ...
    (alt.comp.lang.borland-delphi)