On Tue, 2008-06-03 at 18:08 -0400, Alan Cox wrote:
> On Tue, Jun 03, 2008 at 06:20:52PM -0300, Mauro Carvalho Chehab wrote:
> > > Yeah, they can go.  I left them in as an aid for double checking that I
> > > didn't forget any callbacks that needed to be implemented.
> > 
> > Please don't do that. All static vars that have a value 0 or NULL shouldn't 
> > be
> > initialized, since this will eat some space inside the module.

Mauro,

OK.


Alan,

> The compiler is smarter than that. Besides which 4 bytes will make no 
> difference
> whether it is data or bss given 4K disk block sizes 8)

Objdump reveals, unfortunately the compiler isn't that smart.  It does
explicitly create code to store the NULL pointers.  

For the record, every pointer store looks something like this (before
relocations) on 64-bit:

   1f9:       48 c7 87 c0 04 00 00    movq   $0x0,0x4c0(%rdi)
   200:       00 00 00 00 

11 bytes * 19 NULL pointer stores = 209 bytes + wasted CPU cycles.


Quite honestly, I would have thought the compiler smart enough to do
something like

        xor %rax, %rax
        mov %rax, 0x123(%rdi)

as most of the NULL pointer stores happened in groups of two or three.
But apparently, it wasn't.

-Andy

> It is coding style not to do it but it isn't a bad idea to leave them in if
> they make something explicitly clear IMHO.



_______________________________________________
ivtv-devel mailing list
[email protected]
http://ivtvdriver.org/mailman/listinfo/ivtv-devel

Reply via email to