Ethereal-cvs: Re: [ethereal-cvs] cvs commit: ethereal proto.c

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Laurent Deniel <deniel@xxxxxxxxxxx>
Date: Thu, 10 Aug 2000 22:15:16 +0200
Laurent Deniel wrote:
> 
> 
> 1) in almost all other source code, there is :
> 
> #ifdef NEED_SNPRINTF_H
> # ifdef HAVE_STDARG_H
> #  include <stdarg.h>
> # else
> #  include <varargs.h>
> # endif
> # include "snprintf.h"
> #endif
> 
> 2) if a service (i.e. snprintf) can not be used without including
>    some other header files, why not simply add
> 
> # ifdef HAVE_STDARG_H
> #  include <stdarg.h>
> # else
> #  include <varargs.h>
> # endif
> 
> in our snprintf.h file ?

And I can add this :

The way multiple inclusions are checked is bad (in proto.c for instance)
Multiple inclusions shall be checked in the header file itself not in 
the source code like in :

#ifndef __RESOLV_H__
#include "resolv.h"
#endif

#ifndef __REGISTER_H__
#include "register.h"
#endif

since if those names changes ... (and code reading is not easy).

This way should be only used when there is no other option (badly written
system include files for instance ...)

--
Laurent DENIEL        | E-mail: deniel@xxxxxxxxxxx
Paris, FRANCE         |         laurent.deniel@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
                      | WWW   : http://www.worldnet.fr/~deniel
    All above opinions are personal, unless stated otherwise.