Re: [dev] [libutf] Proposal for additional rune utility functions

From: <k0ga_AT_shike2.com>
Date: Tue, 10 Feb 2015 21:45:29 +0100

> On Tue, 10 Feb 2015 21:21:56 +0100
> k0ga_AT_shike2.com wrote:
>
> Hey k0ga,
>
>> When you write a library one of the objects is to minimize
>> what code is included in the binary when the library is linked.
>> When you link with a library you extract object files from the
>> archive, so all the functions of the object file are included
>> in the program, even if the program don't use them.
>
> first off, you probably are talking about static linking.
> Secondly, this may have been true 10 years ago but compilers have
> become smarter and cut out unnecessary parts.

Yes, I speak about static linking, because It is what we have in
sbase, so dynamic linking is outside of this discussion (ant it is
not suckless :P). And maybe compilers are smarters, but the link
process is the same. Try it and you will see it. Even if you find
some too much smart linker that does it, you are doing something
wrong and requiring a more complex toolchain. I hope we will
not have to implement this kind of linkers some day ;).

>> But I think this is not the case of chartorunearr that is a uncommon
>> function that has 3 calls to other functions, for example strlen and
>> emalloc, so it means you are going to have them in your program even
>> if you use only runelen. This is something very bad.
>
> chartorunearr() calls charntorune(), so it fits into rune.c. The above
> argument applies, meaning, that compilers cut stuff out it doesn't need.

Again, try it.

Regards,
Received on Tue Feb 10 2015 - 21:45:29 CET

This archive was generated by hypermail 2.3.0 : Tue Feb 10 2015 - 21:48:07 CET