lkml.org 
[lkml]   [2001]   [Aug]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 2.4.9 does not compile [PATCH]
Hi,

Thanks for the reply, but...

At 02:46 17/08/2001, Jeff Dike wrote:
>aia21@cam.ac.uk said:
> > Really? Could you point out an example where using ... typeof(x) __x;
> > typeof(y) __y; ... in the macros wouldn't work? - I just tried a few
> > examples I thought wouldn't work (side-effects ones) but I was
> > pleasantly surprised to that gcc always produced the exact same
> > assembler output for both the 3 arg and the 2 arg + typeof macros.
>
>Try min(a, min(b, c)). Look at the cpp expansion and notice all the variable
>name clashes.

There are no clashes; unless my knowledge of C has abandoned me at the
moment, you can reuse variable names within local statement blocks and the
compiler is intelligent enough to sort it out.

I tried egcs-1.1.2/gcc-2.91.66, gcc 2.95.3 (SuSE 7.1) and gcc 2.96 (RHL 7.1
2.96-85) and the generated assembler is fully correct with all these
compilers for follwing little test (I compiled it with the same gcc command
line as the kernel uses for the ntfs source files):

--- cut ---
#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));
}
--- cut ---

No warnings are emitted and the assembler is correct if I am not mistaken.

Is my test invalid? I guess I must be missing something, but I can't figure
out what. )-: Perhaps sleeping over it might help...

>We went through this on #kernel one night, and Alan concocted some amazingly
>gross unique identifier generators as a result. To me, this looks like the
>best way to do this.

Shame I missed that... </me really ignorant> which IRC network is this
channel on? Doesn't seem to be on openprojects.net...

Best regards,

Anton


--
"Nothing succeeds like success." - Alexandre Dumas
--
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Linux NTFS Maintainer / WWW: http://linux-ntfs.sf.net/
ICQ: 8561279 / WWW: http://www-stu.christs.cam.ac.uk/~aia21/

-
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.115 / U:15.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site