[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: LYNX-DEV Bad bug in Lynx
From: |
Bela Lubkin |
Subject: |
Re: LYNX-DEV Bad bug in Lynx |
Date: |
Sun, 3 Nov 1996 19:50:18 -0800 |
Alan Rooks wrote:
> > ! /* These strings are used for printfs later */
> > ! memset(underscore_string, '.', sizeof underscore_string);
> > ! underscore_string[sizeof underscore_string - 1] = '\0';
> > ! memset(star_string, '.', sizeof star_string);
> > ! star_string[sizeof star_string - 1] = '\0';
>
> Right, except that you want to fill that star_string with '_', not '.'.
Argh. Sloppy. Sorry...
> Is there a reason why you used sizeof xxx_string, instead of
> sizeof xxx_string - 1, in the memset()'s?
It just felt more normal to stamp a value into an entire structure
rather than entire-structure-minus-one-byte. You're right that the very
next thing we do overwrites that last byte, so it's wasted effort. (If
someone later uses those statements as a template for something else,
and that something else *isn't* a null-terminated string, and if they're
as sloppy as I was in failing to change '.' to '_' in my second memset()
-- then it's better that they pick up a clear-the-entire-structure
statement...)
>Bela<
;
; To UNSUBSCRIBE: Send a mail message to address@hidden
; with "unsubscribe lynx-dev" (without the
; quotation marks) on a line by itself.
;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: LYNX-DEV Bad bug in Lynx,
Bela Lubkin <=