Re: Tryiing just to read/understand this code
- From: ozbear@xxxxxxxxxxx (ozbear)
- Date: Tue, 29 Aug 2006 07:55:14 GMT
On Mon, 28 Aug 2006 10:48:24 -0700, jmcgill
<jmcgill@xxxxxxxxxxxxxxxxx> wrote:
smnoff wrote:
Is line 512 to 521 of the IF statement seen as the single and only line of
the WHILE loop in Line 511?
Yeah. And I totally refuse to buy any argument I've ever heard
against using brackets on control structures, even when they are only
one-statement blocks.
In my shop, you'd format it like this, or maybe you'd be happier
elsewhere :-)
strstr(const char *as1, const char *as2)
{
const char *s1,
*s2;
const char *tptr;
char c;
s1 = as1;
s2 = as2;
if (s2 == NULL || *s2 == '\0') {
return ((char *) s1);
}
c = *s2;
while (*s1) {
if (*s1++ == c) {
tptr = s1;
while ((c = *++s2) == *s1++ && c);
if (c == 0) {
return ((char *) tptr - 1);
}
s1 = tptr;
s2 = as2;
c = *s2;
}
}
return (NULL);
}
Ugh!
Oz
--
A: Because it fouls the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
.
- Follow-Ups:
- Re: Tryiing just to read/understand this code
- From: jmcgill
- Re: Tryiing just to read/understand this code
- References:
- Tryiing just to read/understand this code
- From: smnoff
- Re: Tryiing just to read/understand this code
- From: jmcgill
- Tryiing just to read/understand this code
- Prev by Date: OT/drift: when is a RAMdisk an appropriate solution
- Next by Date: Re: How can I create a Ram Disk within C/C++ program?
- Previous by thread: Re: Tryiing just to read/understand this code
- Next by thread: Re: Tryiing just to read/understand this code
- Index(es):
Relevant Pages
|