A colleague of mine spotted the weirdest XE6 bug so far.

A colleague of mine spotted the weirdest XE6 bug so far.

On an TMS TAdvStringGrid
1.
for i := 0 to Grid.RowCount - 1
 do Grid.RowHeights[i] := rh;

2.
for i := 0 to Grid.RowCount - 1
do begin
  Grid.RowHeights[i] := rh;
end;

Example 1 failed at setting all lines, Example 2 worked.

Does anyone know of an XE6  QC or QP that is related to "missing" begin/end enclosures?

Comments

  1. Was this reproducable?
    Do you have a test project?

    ReplyDelete
  2. Of course it only happens in a 600.000+ line project with lots of dependencies. It was reproducible.

    ReplyDelete
  3. :-)
    Dealing with row counts ... do you have the same problem if you use Grid.AllRowCount ?

    ReplyDelete
  4. Nope.  I got a copy of the dialog with TMS, but I didn't check it out myself. Too many other tasks.

    ReplyDelete
  5. I kinda think you deserve that given your code formatting :P

    Could RowHeights property be non-trivial and this has something to do with temporaries I wonder...

    ReplyDelete
  6. It took me 25 years to rethink my formatting for readability, and it seems to works for the team. Conditions on one or more lines, statements on one or more following lines - after a do/then (begin/end) - never on the same line. Don't diss it until you've tried it ;)

    I don't even have a theory to why this should go wrong.

    ReplyDelete
  7. Lars Fosdal We have one style per coder... Which at least makes it easy to know who to pester when you're wondering some piece of code is doing :P

    Back on topic, I'd love to see the asm output of the two.

    ReplyDelete
  8. interesting bug, I use begin-end even for one liners -- habit developed in the past few years -- I wonder what you mean by failed to insert all lines, how many lines is example #1 missing?

    ReplyDelete
  9. It appeared to be half the numbers, but that is based on a single sample.

    ReplyDelete
  10. wow! so, the compiler goes 50-50 and we're even?! (:

    ReplyDelete

Post a Comment