tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Armstrong <a...@tagish.com>
Subject Re: [J-T-C] struct defs
Date Thu, 05 Jul 2001 07:36:05 GMT
The reason would be to keep the implementation details of the structure
private so that people aren't tempted to access the fields directly. All
the caller gets is an opaque handle. Think of it as 'objects lite' for
C.

GOMEZ Henri wrote:
> 
> We found many definitions like this
> in mod_jk :
> 
> xxx.h
> 
> struct jk_map;
> typedef struct jk_map jk_map_t;
> 
> xxx.c
> 
> struct jk_map {
>     jk_pool_t p;
>     jk_pool_atom_t buf[SMALL_POOL_SIZE];
> 
>     char **names;
>     void **values;
> 
>     unsigned capacity;
>     unsigned size;
> };
> 
> Why not having it directly in xxx.h
> 
> typedef struct {
>     jk_pool_t p;
>     jk_pool_atom_t buf[SMALL_POOL_SIZE];
> 
>     char **names;
>     void **values;
> 
>     unsigned capacity;
>     unsigned size;
> } jk_map_t;
> 
> -
> Henri Gomez                 ___[_]____
> EMAIL : hgomez@slib.fr        (. .)
> PGP KEY : 697ECEDD    ...oOOo..(_)..oOOo...
> PGP Fingerprint : 9DF8 1EA8 ED53 2F39 DC9B 904A 364F 80E6

-- 
Andy Armstrong, Tagish

Mime
View raw message