This is the mail archive of the gdb@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

#define XMALLOC(TYPE) (TYPE*) xmalloc (sizeof (TYPE))


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]