CBFalconer said:
As I said, the proposed defines themselves are illegal. You cannot
redefine malloc, nor free, nor realloc. Any programmer doing so
should be summarily shot at dawn. [...]
I plead extenuating circumstances, and throw myself
on the mercy of the Court. I knew it was wrong when I
did it, but I was desperate, Your Honor. I could see
that my program was leaking memory, and I'd been over
and over it without finding the leak, and all my efforts
got nowhere, and the pills weren't helping any more ...
Well, I >sob< did it. I confess, I confess, I went
and did it. Here is the awful extent of my shame, for
all to see and shudder at:
void *md_malloc(size_t);
void *md_calloc(size_t,size_t);
void *md_realloc(void*,size_t);
void md_free(void*);
#define malloc md_malloc
#define calloc md_calloc
#define realloc md_realloc
#define free md_free
Oh, I know I deserve your anger! But hear the plea
of a programmer in desperate straits! Once I took that
first awful step, I was hooked: it was an addiction, Your
Honor, the drug of non-conformance had polluted my soul
and I was no longer in control of my actions. Out of my
mind with the delirium of having gotten away with it, I
compounded my felony:
void *md_xmalloc(size_t);
void *md_xcalloc(size_t,size_t);
void *md_xrealloc(void*,size_t);
#define xmalloc md_xmalloc
#define xcalloc md_xcalloc
#define xrealloc md_xrealloc
thus violating not only the Standard, but the non-Standard.
Oh, Your Honor, have mercy. I was out of my head.
But I found the leak (it was in the implementation's
non-Standard stat() function), and I found a work-around.
And although I'm sorry -- truly, abjectly sorry, Your
Honor -- in a strange way I'm really not sorry at all.
Come to think of it, I'm not only "not sorry" but GLAD!
Yes! Glad! Ha-hah, do your worst, you shrivelled tyrant!
I laugh in your pimply face, I scorn your >sneer< conformity!
And I cry out, in one last act of proud defiance
"Shoot if you must this old gray head,
But spare your coder's hack," he said.
Besides, I don't fear you and your pipsqueak firing
squad. Standard-shackled all, they couldn't hit the br-
(TRANSCRIPT ENDS. FURTHER DEPONENT SAITH NOT.)