space allocation for sprintf()
Peter Eichler
peic at core.north.de
Tue Jun 11 04:15:10 AEST 1991
In article <1991Jun5.174543.266 at dg-rtp.dg.com>, Eric R Vook writes:
>
>Harbison & Steele p.328 contains the following parenthetical comment
>after a discussion of sprintf():
>"(It is the programmer's responsibility to ensure that the destination
> string area is large enough to contain the output generated by the
> formatting operation.)"
> ["C: A Reference Manual," 2nd ed, Harbison & Steele, p.328]
>
>I have just a short question, two-part question:
> How do you know how much space to allocate?
Well, look at the stuff you like to put into your destination string.
If I'm printing 5000 floats, it should be more 100 Bytes... ;-)
>Or
> How do you know when you didn't allocate enough?
If your machine crashes instantly, behaves strangely or your system
crashes later, you WILL know (well maybe, case the error is often hard
to find)
> [...]
>-Eric
Cheerio,
Peter
Since pleasure is the Unique, to reveal Pleasure is itself a unique duty. FGTH
------------------------------------------------------------------------------
SNAIL:Peter Eichler \ Hegelstrasse 3 \ 2800 Bremen 1 \ Germany Amiga 3000
EMAIL:peic at core.north.de OR peic at skuld.north.de: VOICE:(+)49 421 530642
More information about the Comp.lang.c
mailing list