After the master guidance, the notes, very grateful for a colleague willing to study technology, the following is not my original, is his analysis of the results
#include <stdio.h>#include<time.h>structLock_class_key {intck;};#defineMutex_init () Do { Static structLock_class_key __key; Static intA; printf ("macro==>>line=%d,&__key=0x%p &a=0x%p\n", __line__, &__key, &a); } while(0)void__mutex_init () { Do { Static structLock_class_key __key1; Static intA1; printf ("function==>>line=%d,&__key1=0x%p &a1=0x%p\n", __line__, &__key1, &A1); } while(0); }intMainvoid){//Do {static struct lock_class_key __key; static int A; printf ("Macro==>>line=%d,&__key=0x%p &a=0x%p\n" , &__key, &a); } while (0);===> macro expansion is like this, GCC-E-o test.i test.c//Do {static struct lock_class_key __key; static int A; printf ("Macro==>>line=%d,&__key=0x%p &a=0x%p\n" , &__key, &a); } while (0);//{static struct lock_class_key __key; static int A; printf ("Macro==>>line=%d,&__key=0x%p &a=0x%p\n", &__key, &a); }//{static struct lock_class_key __key; static int A; printf ("Macro==>>line=%d,&__key=0x%p &a=0x%p\n", &__key, &a); } {Static intB1;} =======> This type of parenthesis is scoped, a function name has only one scope, but if this is added to the functions, which is equivalent to two scopes, it is allowed to be defined, and the address will be different .//printf ("fuck!! \ n ");{Static intB1;} Mutex_init (); Mutex_init (); __mutex_init (); __mutex_init (); return(0);} Executive Result: Macro==>>line=Panax Notoginseng, &__key=0x0x60104c &a=0x0x601050macro==>>line= -, &__key=0x0x601054 &a=0x0x601058function==>>line= +, &__key1=0x0x601044 &a1=0x0x601048function==>>line= +, &__key1=0x0x601044 &a1=0x0x601048
Linux C-Bracket Scope "original notes"