On Mon, 2008-09-08 at 15:06 +0200, Henning Rogge wrote:
> Am Montag 08 September 2008 14:34:16 schrieb Bernd Petrovitsch:
[...]

> The trick is to abstract but to keep good code... my design goal for the 

The trick is IMHO to abstract and get/keep good design.
Good code falls then out on it's own.

> packetbb parser is a completely generic parser which does not need to 
> allocate any kind of memory during parsing (as an example).

One can do that with lex/yacc too - it's just a question what you
"deliver" from lex.

> > Yes, sometimes (especially with old libs like xdr, rpcgen etc.) that
> > gets messy (and "free(void *)" is broken defined in the C
> > standard/POSIX/SUSv3 BTW. That should better be "free(const void *)").
> >
> > And then you are doing something wrong. The duplicated set of accessors
> > in src/common/avl.h is IMHO a strong sign that we should get rid of them
> > completely.
> > I see no real value in them anyways: for "hiding of internals" to the
> > rest of the world they are IMHO too low level (and one wouldn't use them
> > internally anyways).
> > And what's their practical value?
> I see no practical reason for C "const" except something like a comment "this 

I meant the one-line accessors in src/common/avl.h, where we need a
"const" and a non-"const" version.

> should not be modified".
It is not more. And the practical reason is, that the compiler checks it
also.

> > Then fix you *C-compiler* and/or it's settings.
> > If the compiler produces a warning, you are *not* using a C-compiler
> > (but more probably a C++ compiler).
> > Sorry, "people with misconfigured and/or br0ken environments" are not a
> > good reason IMHO.
> > If someone really wants to support C++ compilers (for whatever reason),
> > please find a saner solution than to add type casts (and/or disable
> > warnings).
> I have to check this at home, I think a gcc (not g++) with -Werror and -Wall 
> throws an error for converting a void* into another pointer without a 
> typecast.
If yes, which version?

> > So I'm more the "do `find -name '*.[ch]' -print0 | xargs -0r perl -w -i
> > -p -e 's/olsr_u8_t/uint8_t/' and remove the typedef" person.
> > Hmm, I have to try <inttypes.h> on Win32.
> exactly... if this doesn't work on windows and OSX we cannot use it.

According to src/olsr_types.h, OSX currently does this.
And the Win32 code simply defines "uint8_t" and family (and uses it
afterwards).

	Bernd
-- 
Firmix Software GmbH                   http://www.firmix.at/
mobil: +43 664 4416156                 fax: +43 1 7890849-55
          Embedded Linux Development and Services




