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

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

Good evening,



>
> What is left to discuss is where to put these functions. I would propose
> to place chartorunearr into rune.c, where already chartorune() and
> others reside.
> I would place readrune() and writerune() into a new file called
> runeio.c.
> The name doesn't really matter, because on the outside, only the utf.h-
> header will be exported.
>

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.

So the common way is to put every function in a different file with
the name of the function. You can argue that in rune.c there are
several functions, but if you look them, you will see runetochar calls
runelen, chartorune calls charntorune, chartorune calls runelen,
runenlen calls to runelen and fullrune calls to charntorune, so the
dependences between them are really strong, and they are small
functions, so it is not a big problem.

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.

With the case of writerune and readrune I don't understand why
you when them together in a file, and force the linker to include
them, when they are no any dependences between them.

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

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