Liste des Groupes | Revenir à cl c |
On Thu, 30 May 2024 02:32:03 -0000 (UTC)In real life, in embedded software projects, I'd use xxd or a few lines of Python and have an initialised const array in the code. Why would you use something that "feels like magic" (i.e., may be mystical and hard to understand for other developers) and is more limited? To save three seconds of build time on the rare occasions when the source binary changes?
Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
On Wed, 29 May 2024 13:58:20 +0200, Bonita Montero wrote:Of course, it is more efficient.
>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.
But:
- it covers fewer use cases.
- it exposes array's name and size as global symbols which is not
always desirable
- 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.
But yes, in real life, in embedded software project, that's what I'd do.
Les messages affichés proviennent d'usenet.