[PATCH] top: fix parsing of /proc/meminfo
Cathey, Jim
jcathey at ciena.com
Tue Jul 22 17:07:15 UTC 2014
>Am I missing something here? There is no structure, just a character
>pointer. If you leave off "static" it will be compiled as an
>instruction that pushes a constant onto the stack, by any/every compiler.
Which is probably _larger_ code than just referring to something
stored in the .text/.data segment. It's copying something that is
found in text/data into the stack space, then referring to that
address thereafter. The compiler has to do:
Copy A->B
Then use &B.
-vs-
Use &A.
You do this when you want the ability to modify B.
If A is fixed and inviolate, you mark it static const
and be done with it. What this turns into, exactly,
depends upon your compiler, CPU, and ABI, but I can't
think of any case where the extra copy is going to
turn out _better_ than the simpler case.
-- Jim
More information about the busybox
mailing list