The rsult is also same, you go too far. Code I want to show a fact in Linux, when a process load a library into memory, such as 0x1000
---- foo.so 0x1000 ELF header .text section .data section .bss section ... Here data in 0x1000 and its follower have an *exact* map to foo.so in disk, you need review my code, so which can bring an optimization is offsetof(C - A) is const. Further, everything in data/bss section has a fixed offset to text section. 2009/11/26 Alexandre Oliva <aol...@redhat.com>: > On Nov 26, 2009, yunfeng zhang <zyf.zer...@gmail.com> wrote: > >> The result is the same > > But the code isn't. See how, with hidden, we use the fixed offset. > > Now remove the hidden attribute, define g also in the main program, and > see what it prints. > > -- > Alexandre Oliva, freedom fighter http://FSFLA.org/~lxoliva/ > You must be the change you wish to see in the world. -- Gandhi > Be Free! -- http://FSFLA.org/ FSF Latin America board member > Free Software Evangelist Red Hat Brazil Compiler Engineer >