Re: Style convention question



On Fri, Mar 09, 2001 at 10:16:22AM -0800, Darin Adler wrote:
> on 3/9/01 9:59 AM, Mark Mielke at mark mark mielke cc wrote:
> > This should be in the form:
> > 
> > #ifdef __cplusplus
> > #  define DECLARE_STRUCT(A)    struct A
> > #else
> > #  define DECLARE_STRUCT(A)    typedef struct A A
> > #endif
> > 
> > DECLARE_STRUCT(A);
> > DECLARE_STRUCT(B);
> There's no need to do this ifdef. "typedef struct A A;" is allowed in C++
> and has the same effect as "struct A;".

There is no need to do the typedef in C++.

It requires additional symbols to be allocated, requires more memory, and
will slow compiles down.

Perhaps by just a touch -- however, the same compile will be slowed down
from now until this code becomes obsolete.

2% faster or less, at the cost of one #ifdef.

Isn't it worth it?

mark

-- 
mark mielke cc/markm ncf ca/markm nortelnetworks com __________________________
.  .  _  ._  . .   .__    .  . ._. .__ .   . . .__  | Neighbourhood Coder
|\/| |_| |_| |/    |_     |\/|  |  |_  |   |/  |_   | 
|  | | | | \ | \   |__ .  |  | .|. |__ |__ | \ |__  | Ottawa, Ontario, Canada

  One ring to rule them all, one ring to find them, one ring to bring them all
                       and in the darkness bind them...

                           http://mark.mielke.cc/





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