On Friday, 15 August 2014 at 16:51:20 UTC, Philippe Sigaud wrote:
On Friday, 15 August 2014 at 16:48:10 UTC, monarch_dodra wrote:
Make sure you don't use that if your type has elaborate construction, or assumes a certain initial state (unless you are actually emplacing your objects of course).

Hmm, what's elaborate construction? They are classes and have constructors, of course. I assumed that this produced only null's in the array.

Actually, my statement was inaccurate. More specifically, never use anything that wasn't first properly initialized. Note that in some cases, "operator=" is itself elaborate, meaning it will also read data, so that's not a valid method of initialization.

uninitializedArray simply creates an array with unspecified data in it.

You *could* just use "new" instead. It's not really any slower, and has the advantage of being certifiably safe.
              • ... Philippe Sigaud via Digitalmars-d-learn
              • ... Dicebot via Digitalmars-d-learn
              • ... Philippe Sigaud via Digitalmars-d-learn
              • ... Messenger via Digitalmars-d-learn
              • ... Philippe Sigaud via Digitalmars-d-learn
              • ... monarch_dodra via Digitalmars-d-learn
              • ... monarch_dodra via Digitalmars-d-learn
              • ... Philippe Sigaud via Digitalmars-d-learn
              • ... monarch_dodra via Digitalmars-d-learn
              • ... Philippe Sigaud via Digitalmars-d-learn
              • ... monarch_dodra via Digitalmars-d-learn
              • ... Jonathan M Davis via Digitalmars-d-learn
              • ... monarch_dodra via Digitalmars-d-learn
        • Re: Appender ... Jonathan M Davis via Digitalmars-d-learn
      • Re: Appender is .... Dicebot via Digitalmars-d-learn
  • Re: Appender is ... slow Joseph Rushton Wakeling via Digitalmars-d-learn

Reply via email to