comp.lang.ada
 help / color / mirror / Atom feed
From: Vinzent 'Gadget' Hoefler <nntp-2004-12@t-domaingrabbing.de>
Subject: Re: Efficiently setting up large quantities of constant data
Date: Fri, 17 Dec 2004 08:38:41 +0000
Date: 2004-12-17T08:38:41+00:00	[thread overview]
Message-ID: <25075763.yogBpGQTl0@jellix.jlfencey.com> (raw)
In-Reply-To: oPWdnb-vfc0D8V_cRVn-gw@comcast.com

tmoran@acm.org wrote:

>>You could give "objcopy" a try. It can convert a binary file into an
>>object file which could then be linked normally.
>
>   You could also create an asm (remember that?) file with the data
> and link the resultant object file.

Yes. BTDT.

>   What's wrong with just creating an Ada source file with all the
>   constant data?

It's nothing wrong with it. But sometimes it just may seem a little bit
overkill to create source code from a binary to be compiled by a
compiler to get an object file to be linked by the linker when you can
create the needed object file in just one single, fast step with
bin2obj/objcopy. :)

> That would give you the advantage of the compiler doing the
> worrying about the data representation and layout and doing some
> checking that you are accessing things correctly.

Yes, agreed. If you really need this.

But if the file is essentially just an array of basic types I see not
much sense in doing all the steps mentioned above just to link a
lookup-table into the executable.

I mean, what kind of checking can the compiler do on a simple array of
integers?
Especially in the case when the program that writes the binary data uses
the same packages with the type declaration as the program where the
precomputed result is linked into?

Oh, and floating point data might be a little bit funny, if you convert
the binary result to textual representation, and then let the compiler
convert it back to its binary equivalent. ;-)


Vinzent.



  reply	other threads:[~2004-12-17  8:38 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-13 21:48 Efficiently setting up large quantities of constant data Michael Mounteney
2004-12-13 22:09 ` Stephen Leake
2004-12-13 22:15 ` Luke A. Guest
2004-12-14  0:20 ` Jeffrey Carter
2004-12-14  8:43 ` Martin Krischik
2004-12-14 12:18 ` Simon Wright
2004-12-15 21:10   ` Brian May
2004-12-16 23:18     ` Nick Roberts
2004-12-16 12:36 ` Dr. Adrian Wrigley
2004-12-16 13:50   ` Marc A. Criley
2004-12-17  2:32     ` John B. Matthews
2004-12-16 14:06   ` rien
2004-12-16 14:24   ` Vinzent 'Gadget' Hoefler
2004-12-16 18:12     ` Dr. Adrian Wrigley
2004-12-16 23:25       ` Nick Roberts
2004-12-17  5:20     ` tmoran
2004-12-17  8:38       ` Vinzent 'Gadget' Hoefler [this message]
2004-12-17 13:53     ` Dr. Adrian Wrigley
2004-12-17 14:16       ` Alex R. Mosteo
2004-12-16 17:11   ` Andre
2004-12-16 21:52     ` Larry Kilgallen
2004-12-16 23:23       ` Nick Roberts
2004-12-16 23:47       ` Dr. Adrian Wrigley
2004-12-19 14:34         ` Simon Wright
2004-12-16 18:29 ` Alex R. Mosteo
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox