Sujet : Re: C23 thoughts and opinions
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.lang.cDate : 01. Jun 2024, 02:45:51
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v3duge$2febh$4@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
User-Agent : Pan/0.158 (Avdiivka; )
On Thu, 30 May 2024 11:09:05 +0300, Michael S wrote:
On Thu, 30 May 2024 02:32:03 -0000 (UTC)
Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
On Wed, 29 May 2024 13:58:20 +0200, Bonita Montero wrote:
I've got a small commandline-tool that makes a const'd char -array
from any binary file.
It seems to me it would be more efficient to use objcopy to turn that
binary file directly into an object file with symbols accessible from C
code defining its beginning and ending points. Then just link it into
the executable.
Of course, it is more efficient.
But:
- it covers fewer use cases.
There are many ways of embedding a binary blob in a software project. This
is just one tool for that; there are other tools for other cases (see the
Unicode Browser for Android example that I mentioned elsewhere).
- it exposes array's name and size as global symbols which is not
always desirable
Lots of other things already need to be global symbols, I don’t see why a
couple more make a difference to anything.
Look at how large projects like the Linux kernel deal with this sort of
thing.
- it feels too much like a magic. It would feel less like a magic if
done by compiler rather than by extra tool. Even better if done by
compiler in standardized manner.
I don’t understand this at all. I never had the assumption, in any real-
world build system, that all the generated code had to come from some
“official” compiler for some “official” language.