[patch] misc minor shrinkage and smalltype question

Denis Vlasenko vda.linux at googlemail.com
Sat Jan 20 15:19:46 PST 2007


On Saturday 20 January 2007 22:21, Bernhard Fischer wrote:
> > /* It is perfectly ok to pass in a NULL for either width or for
> >  * height, in which case that value will not be set.  */
> >-int get_terminal_width_height(int fd, int *width, int *height)
> >+int get_terminal_width_height(const int fd, int *width, int *height)
> >
> >Does const help? Smaller code or what?
> 
> Here it is used to make sure that noone ever has the idea to write to
> it. Precaution.

Inside the function body? It is small enough to check by hand.

I wouldn't have problem with this but this "const"
has to be mentined in prototypes in .h file also.

So if you ever change _internals_ of a function
and you need to add/drop "const", you _must_ modify prototype
in .h file. It just doesn't feel completely right.

int f(const char *cp, char *const pp, const int n);

"const" at cp looks ok, at pp and n - doesn't.

> >-frtl-abstract-sequences, -Wno-error - what they are doing?
> 
> Wno-error turns off -Werror. I should have removed it alltogether
> instead.
> 
>        -frtl-abstract-sequences
>            It is a size optimization method. This option is to find identical
>            sequences of code, which can be turned into pseudo-procedures and
>            then  replace  all  occurrences with  calls to  the  newly created
>            subroutine. It is kind of an opposite of -finline-functions.  This
>            optimization runs at RTL level.
> 
> It saved more than 2k for me. Quick'n easy :)

Cool!
Small comment about it in Makefile won't hurt ;)

> >BTW my gcc 4.1.1 gives me strange small variations whenever I touch
> >headers, in _totally_ unrelated places.
> >I thought -fno-guess-branch-probability will help (that one
> >said to disable non-deterministic (i.e. semirandom) branch probability
> >prediction by gcc), but no...
> 
> I think there is something amiss with the dependency tracking, too.
> With the tty changes from above, the tty.o was not reliably rebuilt if
> one toggles the SUSv2 .config option

Yeah, I'm seeing it too. I turned on CONFIG_ASH, "make" relinks bbox,
but it still doesn't have ash.
--
vda


More information about the busybox mailing list