Re:How to design a replacement for C++
by nuxi on Thursday July 22, 2010 @01:39PM
(#1538906)
Ah okay, I understand what you meant now.
One thing however - if it is a macro, couldn't it just be:
At least C89/90 only mentions that if it is a macro, it may evaluate arguments more than once (but then it may not, as in the above case).
[ Parent
| on HN ]
Re:How to design a replacement for C++
by JoachimSchipper on Thursday July 22, 2010 @08:15PM
(#1539982)
Yes and no. Yes, that is a valid #define; but the following program must work:
#include <stdio.h>
#undef getc
int main(void) {
getc(stdin);
return 0;
}
so it cannot be implemented as only a macro.