Jan 24

Copy&Paste Code Failure

Tag: General lifetrevor @ 11:35 am

Spent the last half hour trying to figure out why the compiler was creating two objects instead of one, every time this code ran:

mmoBlockInternal *bi = new mmoBlockInternal( blockType, crossSection, offset, materialName, cap );new mmoBlockInternal( blockType, crossSection, offset, materialName, cap );

The second ‘new’ statement, of course, was just barely off the right-hand side of my editor window.

4 Responses to “Copy&Paste Code Failure”

  1. Dan Haraj says:

    Takes balls to admit you made a mistake like that :p

  2. trevor says:

    Oh, I make heaps of mistakes. Only the particularly entertaining or embarrassing ones end up on the site.

    This one isn’t particularly entertaining unless you summon a mental image of me feverishly stepping in and out of code, trying to figure out why the game is allocating two objects when the code clearly is only asking for one, and only after half an hour noticing that the source window inexplicably has a horizontal scroll bar… :)

  3. token88 says:

    HAHA, i feel your pain ive done that on the more then one occcasion
    usually when editing film or videos, i get a bunch of key frames missing, so i start freaking out but it is usually cos i didnt scroll all the way along

  4. Pokelover says:

    Aww, man… gotta love it when things like that happen