#define XMALLOC(TYPE) (TYPE*) xmalloc (sizeof (TYPE))
Andrew Cagney
ac131313@cygnus.com
Wed Nov 3 01:15:00 GMT 1999
Hello,
Here is a style question. A convention I adopted when developing psim
(gdb/sim/ppc) was to use the macro:
#define XMALLOC(TYPE) (TYPE*) xmalloc (sizeof (TYPE))
vis:
struct xyz *x = XMALLOC (struct xyz);
rather than the more common:
struct xyz *x = (struct xyz *) xmalloc (sizeof (struct syz)); /*[sic]*/
It's a poor persons ``new()''. Would people react violently if this
definition was pushed into defs.h where it could be used more widely?
This is very different to making it a requirement of any coding
standard.
enjoy,
Andrew
More information about the Gdb
mailing list