This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] Fix gdb/277 by separating types
- From: Andrew Cagney <ac131313 at cygnus dot com>
- To: Eli Zaretskii <eliz at is dot elta dot co dot il>,Daniel Jacobowitz <drow at mvista dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Mon, 13 May 2002 09:30:40 -0400
- Subject: Re: [RFA] Fix gdb/277 by separating types
- References: <Pine.SUN.3.91.1020513081759.8317L-100000@is>
> On Sun, 12 May 2002, Daniel Jacobowitz wrote:
>
>
>> This patch requires my previous cleanup patch. It fixes a test in
>> gdb.c++/method.exp for GCC 3.x/stabs+, and closes gdb/277.
>
>
> A minor comment about style:
>
>
>> type = (struct type *) xmalloc (sizeof (struct type));
>> + memset ((char *) (type), 0, sizeof (struct type));
>
>
> Why the cast to `char *' in the first argument of memset? I thought,
> since we require an ISO C compiler, we shouldn't need those anymore.
> (There are more casts like that in the patch.)
Yes.
> The same goes for casting the return value of xmalloc, I think.
Yep. That one can have merit though.
I personally use that XMALLOC macro (yes a macro I like :-). Having had
to chase a few problems with memset VS void* in regbuf, I'm now (sadly)
tempted to #define MEMSET(VAR, VAL) memeset (&(VAR), (VAL), sizeof
(VAR)). Rest assured, neither are in GDB's coding standard.
Andrew