lkml.org 
[lkml]   [2001]   [Aug]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: 2.4.9 does not compile [PATCH]
Date
On August 17, 2001 03:49 am, Andrew Morton wrote:
> Anton Altaparmakov wrote:
> >
> > #define min(x,y) \
> > ({ typeof(x) __x = (x); typeof(y) __y = (y); __x < __y ? __x :
__y; })
> >
> > int test(int a, int b, int c)
> > {
> > return min(a, min(b, c));
> > }
>
> Problems occur if the caller happens to pass in variables whose
> names confilct with the ones you chose in the above macro:

I remember the thread in detail. We must have similar scoping problems in
innumerable macros. I'd a braindead flaw in C's scoping rules, and you know,
I don't think it matters. Don't use local variables with names like __foo.

--
Daniel
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:57    [W:0.097 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site