bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: src/kwset.c (kwsincr): Replace arbitrary array size by proper value


From: Paul Eggert
Subject: Re: src/kwset.c (kwsincr): Replace arbitrary array size by proper value
Date: Mon, 04 Jul 2005 22:44:43 -0700
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Charles Levert <address@hidden> writes:

> I have checked that this will hold for CHAR_BIT
> up to 1023.  Custom tools used for checking
> this available upon request (part analytical,
> part experimental).

Can you please put a comment to this effect in the source code, where
it's less likely to get lost?  It would help to document as much as
you can, as long as it's concise.

> +#if CHAR_BIT < 4
> +#error "CHAR_BIT is smaller than 4; yeah, right!"
> +#else
> +#define DEPTH_SIZE (CHAR_BIT + CHAR_BIT/2)
> +#endif

Please change the name from DEPTH_SIZE to DEPTH_BOUND (since it's
an upper bound), and please avoid the #else.  Also, please indent
the preprocessing directive, and please use a clearer diagnostic.
Finally, please use the GNU coding style for spacing within expressions.

Something like this, perhaps:


/* Upper bound for depth of trie.  This bound is valid for CHAR_BIT >= 4 and
   exact for CHAR_BIT in { 4..11, 13, 15, 17, 19 }.  For details, please
   see grep-internals.texi.  */
#if CHAR_BIT < 4
# error "configuration error: impossible CHAR_BIT"
#endif
#define DEPTH_BOUND (CHAR_BIT + CHAR_BIT / 2)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]