Re: how to test this piece of C code
- From: Richard Heathfield <rjh@xxxxxxxxxxxxxxx>
- Date: Sat, 10 Mar 2007 07:59:46 +0000
subramanian100in@xxxxxxxxx, India said:
<snip>
if (curSize > SIZE_MAX - blockSize)
Replace this code with:
if (curSize > MAX_BLOCK_LENGTH - blockSize)
and #define MAX_BLOCK_LENGTH in a header somewhere. For one thing, you
probably don't want it to be SIZE_MAX anyway (although, if you do, you
can define it as such in your header), and for another thing, it means
you can easily tweak it down to more easily tested values when need be
without having to hack at your source code each time.
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
.
- Follow-Ups:
- Re: how to test this piece of C code
- From: subramanian100in@xxxxxxxxx, India
- Re: how to test this piece of C code
- References:
- how to test this piece of C code
- From: subramanian100in@xxxxxxxxx, India
- how to test this piece of C code
- Prev by Date: Re: origin of "application" for computer programs
- Next by Date: Re: Converting Numbers to Words in English by recursion.
- Previous by thread: how to test this piece of C code
- Next by thread: Re: how to test this piece of C code
- Index(es):
Relevant Pages
|