Array void init
Stewart Gordon
smjg_1998 at yahoo.com
Thu May 16 23:46:31 PDT 2013
On 27/04/2013 06:29, Steven Schveighoffer wrote:
<snip>
> Have you considered what this does? Consider a standard [1.0, 2.0] call:
>
> In essence, it pushes 1.0 and 2.0 onto the stack, then calls a function
> to allocate the memory and use the given data.
<snip>
Does it? I would have thought it stores the numbers in the static data
segment, and uses a block memory copy in order to use it to initialise a
static array.
This would explain why initialising individual elements as void isn't
supported. The point of initialising as void is to eliminate the
overhead of initialising when you're just going to populate the array
programmatically anyway. But with a block memory copy you can't skip
over individual elements, so would have to initialise it bit by bit,
which defeats the point since void is supposed to eliminate overhead,
not create more.
Stewart.
--
My email address is valid but not my primary mailbox and not checked
regularly. Please keep replies on the 'group where everybody may benefit.
More information about the Digitalmars-d
mailing list