On Tue, Jan 20, 2009 at 11:15:02PM +0000, Martin Stjernholm, Roxen IS @ Pike  
developers forum wrote:
>   array a = ({0});
>   for (int i = 1; i < 1000; i++)
>     a += ({i});
> (To make the example simpler, I start out with the array ({0}) instead
> of the empty array ({}) since the empty array always is shared.)

is that actually making code faster or is it only to make the logic of
the problem you are discussing simpler?

> One alternative is to extend the array type to explicitly allow adding
> elements to the end destructively. It could perhaps look like this:
>   a[sizeof (a)] = i;

what about possible code that expects this operation to fail?

mixed error = catch{ a[x] = i; };
if (error)
  write("ooops, we reached the end\n");

greetings, martin. 
          • ... Martin Nilsson (Opera Mini - AFK!) @ Pike (-) developers forum
            • ... Martin Stjernholm, Roxen IS @ Pike developers forum
              • ... Per Hedbor () @ Pike (-) developers forum
              • ... Martin Stjernholm, Roxen IS @ Pike developers forum
              • ... Per Hedbor () @ Pike (-) developers forum
              • ... Martin Stjernholm, Roxen IS @ Pike developers forum
          • ... Henrik Grubbstr�m (Lysator) @ Pike (-) developers forum
            • ... Martin Stjernholm, Roxen IS @ Pike developers forum
              • ... Martin Stjernholm, Roxen IS @ Pike developers forum
              • ... Martin Stjernholm, Roxen IS @ Pike developers forum
              • ... Martin Bähr
              • ... Marcus Agehall (Roxen IS) @ Pike (-) developers forum
              • ... Martin Stjernholm, Roxen IS @ Pike developers forum
          • ... Stephen R. van den Berg
            • ... Martin Stjernholm, Roxen IS @ Pike developers forum
              • ... Stephen R. van den Berg
              • ... Martin Stjernholm, Roxen IS @ Pike developers forum
              • ... Martin Stjernholm, Roxen IS @ Pike developers forum
  • Re: Multi-c... Martin Stjernholm, Roxen IS @ Pike developers forum

Reply via email to