Re: I thought I understood sizeof().
- From: "David Schwartz" <davids@xxxxxxxxxxxxx>
- Date: Sat, 17 Dec 2005 13:50:08 -0800
"Paul Pluzhnikov" <ppluzhnikov-nsp@xxxxxxxxxxx> wrote in message
news:m33bkrxvbs.fsf@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> "David Schwartz" <davids@xxxxxxxxxxxxx> writes:
>> On the flip side, by using 'sizeof', if 'temp' is ever changed to a
>> 'char *', the code will break horribly.
> The application will break visibly (truncating the expected output),
> rather than fail with silent/invisible/hard-to-find stack corruption
> (which would have happened if 'temp' became smaller but snprintf()
> wasn't updated). IMHO, that's a good thing.
Nonsense. You are assuming that the buffer will always be larger than
the size of a character pointer. If we're presuming a change in the size of
the buffer, smaller is also possible.
DS
.
- Follow-Ups:
- Re: I thought I understood sizeof().
- From: Chad
- Re: I thought I understood sizeof().
- References:
- I thought I understood sizeof().
- From: Chad
- Re: I thought I understood sizeof().
- From: Paul Pluzhnikov
- Re: I thought I understood sizeof().
- From: David Schwartz
- Re: I thought I understood sizeof().
- From: Paul Pluzhnikov
- I thought I understood sizeof().
- Prev by Date: Re: Having problems linking files ...
- Next by Date: where's the faq kenneth?
- Previous by thread: Re: I thought I understood sizeof().
- Next by thread: Re: I thought I understood sizeof().
- Index(es):
Relevant Pages
|