Thread (5 messages) flat view 5 messages, 4 authors, 2017-07-28

Re: [PATCH] rt2x00: make const array glrt_table static

From: Colin Ian King <hidden>
Date: 2017-07-12 07:04:43
Also in: kernel-janitors, linux-wireless

On 12/07/17 07:49, Stanislaw Gruszka wrote:
On Tue, Jul 11, 2017 at 12:47:33PM +0100, Colin King wrote:
quoted
From: Colin Ian King <redacted>

Don't populate array glrt_table on the stack but make it static.
Makes the object code a smaller by over 670 bytes:

Before:
   text	   data	    bss	    dec	    hex	filename
 131772	   4733	      0	 136505	  21539	rt2800lib.o

After:
   text	   data	    bss	    dec	    hex	filename
 131043	   4789	      0	 135832	  21298	rt2800lib.o

Signed-off-by: Colin Ian King <redacted>
Acked-by: Stanislaw Gruszka <redacted>

I wonder why compiler do not optimize by itself since array is
const, but patch is ok.
Afraid marking it as const does not guarantee that at all. The const
qualifier just announces that the value will not be changed [1]. So one
requires static const to ensure it's not populated on the stack and also
marked as non-modifiable.

[1] Section A4.4, The C programming Language, page 196

Colin
Stanislaw 
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help