defective technology, defective people at most 660 pixels wide
Macros are far less innocuous than that example pictures them. I remember someone doing something like:#define MIN(a, b) ((a) < (b) ? (a) : (b))int foo(int x) { return x > 0 ? MIN(x, foo(x/2)) : 0;}So evaluating this function took him linear rather than logarithmic time (as it would have happened had he not used a macro).
Post a Comment
1 comment:
Macros are far less innocuous than that example pictures them. I remember someone doing something like:
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int foo(int x) {
return x > 0 ? MIN(x, foo(x/2)) : 0;
}
So evaluating this function took him linear rather than logarithmic time (as it would have happened had he not used a macro).
Post a Comment