Recent

Author Topic: TTreeNodeCompare documentation  (Read 3421 times)

Eclipticon

  • Jr. Member
  • **
  • Posts: 51
TTreeNodeCompare documentation
« on: January 04, 2012, 12:37:16 am »
Hi,

from http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/ttreenodecompare.html:

"returns -1 if Node1 less than Node2, zero if equal, +1 if Node 2 greater"

Is it just me or is that nonsense? Where to report this and what are the real return values?
Lazarus 1.2.4 on Win XP/7 Virtual Machine

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4660
  • I like bugs.
Re: TTreeNodeCompare documentation
« Reply #1 on: January 04, 2012, 12:58:54 am »
Looks correct to me. The function must return an integer, -1, 0 or 1 just like many other similar comparison functions.
Now only the parameters are TTreeNodes instead of pointers as they often are.

Such comparison functions are typically used by binary search and sort functions.

Juha
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Eclipticon

  • Jr. Member
  • **
  • Posts: 51
Re: TTreeNodeCompare documentation
« Reply #2 on: January 04, 2012, 09:25:54 am »
Hi Juha,

no, the way this function works it not what worries me, I'm familiar with that.

What confuses me, is that the conditions for -1 and +1 described in that piece of doumentation are the same:

(Node1 < Node2) -> -1
(Node1 < Node2) -> +1
Lazarus 1.2.4 on Win XP/7 Virtual Machine

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4660
  • I like bugs.
Re: TTreeNodeCompare documentation
« Reply #3 on: January 04, 2012, 01:11:38 pm »
no, the way this function works it not what worries me, I'm familiar with that.

What confuses me, is that the conditions for -1 and +1 described in that piece of doumentation are the same:

(Node1 < Node2) -> -1
(Node1 < Node2) -> +1

Yes. Good catch.
I fixed the explanation in the XML document file in r34572. I don't know when it will be updated to the HTML page.
Now it says: "... +1 if Node1 is greater"

Juha
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

 

TinyPortal © 2005-2018