> Dear All, > > I have seen a macro like this in the Linux kernel sources in > include/linux/usb.h line no: 1090. > > #define usb_dotoggle(dev, ep, out) ((dev)->toggle[out] ^= (1 << (ep))) > > I did not understand how it works? > I have written a small usermode program to test this. > > #define x 1 > #define y 2 > #define macro() (x = y) > main() > { > int abc = macro(); > printf("abc = %d\n",abc); > } > > This code results in a compile error. > test.c:9: error: invalid lvalue in assignment. I do not think this issue is kernel related as much as it may be your inexperience with C. the macro expands to 1 = 2 you are not assigning a varible, you are trying to assign a constant. When the GCC sees this its context checking catches it and gives you the eror. Perhaps you overlooked this accidentally? or maybe you just dont know the C preprocessor very well. In any case, it is pretty simple to rectify, look for "The C Programming Language" by Kernighan and Ritchie Kris P.S. Is this off topic for this list? -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/