strings and constness

Rob Landley rob at landley.net
Sun Jun 18 21:19:37 UTC 2006


On Sunday 18 June 2006 1:45 pm, Jason Schoon wrote:
> Running a very similar test with gcc 3.3.4 on x86 (Built clean using
> defconfig, then added #define const to the top of libbb.h, then rebuilt
> defconfig clean once more, fixing up the few places where header ordering
> had caused an error), I actually ended up with a binary that was 14k
> smaller.

So it's not just me then.  Good to know. :)

> If const were actually an enforced type in a strongly-typed language, I
> might have concern about removing it.  However, given that anybody can
> simply ignore the const by casting, and that it appears to increase binary
> size, not to mention causing unnecessary code fixups, I say whack it.

I'm amused that the rationale given all this time was that the resulting 
binary was smaller if you used const.

Now admittedly, putting some data in the read only section is useful, 
especially on nommu machines.  But function arguments accepting data off the 
stack?

Rob
-- 
Never bet against the cheap plastic solution.



More information about the busybox mailing list