This is the mail archive of the
gdb@sourceware.cygnus.com
mailing list for the GDB project.
#define XMALLOC(TYPE) (TYPE*) xmalloc (sizeof (TYPE))
- To: gdb at sourceware dot cygnus dot com
- Subject: #define XMALLOC(TYPE) (TYPE*) xmalloc (sizeof (TYPE))
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Wed, 03 Nov 1999 20:11:30 +1100
- DJ-Gateway: from newsgroup cygnus.gdb
- Newsgroups: cygnus.gdb
- Organization: Cygnus Solutions
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