Mail Archives: djgpp/1998/02/17/02:32:45
mwallace AT wiltel DOT com (Michael Wallace x3738) wrote:-
> In DJGPP, does the new operator throw an exception if it cannot allocate the
> requested memory? Or does it just return a NULL value.? Mike
It returns 0, plainly, simply, thankfully.
In my experiences with writing Windows applications, Borland C++ `new'
running out of memory throws an exception, which (on top of the near/far/huge
pointer type complication and a muddle of various sorts of `new' and `delete'
with and without round and square brackets after), caused a complication of
`throw' and `catch' and `try' which played pig-in-the-middle with half of a
day of my time before I rejected it and went back to malloc().
#define FM(type,n) (type far*) farmalloc((long)sizeof(type)*(n))
#define HM(type,n) (type huge*) farmalloc((long)sizeof(type)*(n))
Or, as anyone will know who have read Herriot's vet books, "it allus ends up
wi' malloc() at t' finish."
A few useful abbreviating #defines which I often use:-
#define pk __attribute__((packed))
#define reg register
#define uns unsigned
#define OUCH MB_ICONEXCLAMATION
P.S.1: Is there an email group like djgpp but about programming in C/C++ for
Windows?
P.S.2: What is the progress on djgpp for Windows?
- Raw text -