LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] EU Rejects Patent Software Law - For Now

[ILUG] EU Rejects Patent Software Law - For Now

Bryan O'Donoghue typedef at eircom.net
Fri Feb 18 13:01:06 GMT 2005


Colm MacCarthaigh wrote:

> and then later call it with two "char *", the compiler will give it
> those types. I thought this was the best approach, as it's pretty
> flexible. The other approach is to use void pointers (which I don't like
> but that's for other reasons) and cast at every opportunity.  It works
> but it can unreliable. especially if you doing comparisons which use
> pointer-arithmetic. The third approach again is to have specific
> inline functions for each argument type, but that's exhaustive. And of 
> course the simplest approach is to use an argument-type agnostic
> pre-processsor macro - which I think you'll find is what I suggested :)
> 
> But my god is this getting obscure.


_ahem_ but,


#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.


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 ?



More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


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!
RSS Version
Powered by Dell