Coding in sMonthCalendar depends on bool evaluation

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #36915
    HeDiBo
    Participant

    Hi Serge,

    In sMonthCalendar.pas I found this piece of code (lines 991-997):

    Code:
    function TsMonthCalendar.IsValidDate(Date: TDateTime): boolean;
    begin
    if (MinDate <> 0) and (Date < MinDate) or (MaxDate <> 0) and (Date > MaxDate) then
    Result := False
    else
    Result := True;
    end;

    Because I could not verify anymore that this expression is correct (it depends on the way booleans are evaluated), I would like it if you would change it into the more usual form:

    Code:
    function TsMonthCalendar.IsValidDate(Date: TDateTime): boolean;
    begin
    if ((MinDate <> 0) and (Date < MinDate)) or ((MaxDate <> 0) and (Date > MaxDate)) then
    Result := False
    else
    Result := True;
    end;

    Thanks!

    #54937
    Support
    Keymaster

    Hello Dick

    Code depended from boolean evaluation not only in this unit. All package has such way of evaluation.

    #54981
    HeDiBo
    Participant
    'Support' wrote:

    Hello Dick

    Code depended from boolean evaluation not only in this unit. All package has such way of evaluation.

    Looks a bit better now :a3:

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.