On Fri, Feb 18, 2005 at 01:01:06PM +0000, Bryan O'Donoghue wrote:
> #define compare_1(x,y) return(x!=y);
>> won't test memory location equivalence, rather variable value
> equivalence, thus typechecking is needed _forcing_ the calling
> entity/function to dref the input variables.
My god, you really are insane! But before you join the depths of my
procmailrc, where do you get off on this return-in-macros stuff? Macros
should never contain a return statement!
#define ISNOT(x, y) ((x) != (y))
Will test memory-location equivalence if it is passed memory
locations. Just as your below inline function;
> static inline compare_2(void * x, void *y){
> return (x!=y);
> }
>> works for
>> int a;
> int b;
>> if(compare_2(&a,&b))
> printf("Patent infringement\n");
>> whereas
>> if(compare_1(a,b))
> printf("Pay the bill\n");
>> won't, you see ?
You're a loon! compare_2(a, b) is valid C aswell - and won't work.
compare_1(&a, &b) is valid C aswell - it will work. Your calling them
with different arguments, what the hell do you expect?
If you don't pass either the function or the macro memory locations ...
they will, suprise suprise, not compare memory locations. Anyway,
goodbye.
--
Colm MacCárthaigh Public Key: colm+pgp at stdlib.net
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!