Board index » delphi » Delphi 5 Pro lies about my not using variable

Delphi 5 Pro lies about my not using variable

Delphi 5 claims I never use the value returned by a function.  This is
not true, I do us it later in the code if a logical test is passed.  But
since Delphi 5 doesn't think I am using the variable, it doesn't bother
saving the value my function returns.  Can anything be done?  See code
segments below:

....
 BlankIndex : Integer ;
  LastUseIndex : Integer ;
  NewLstUseIndex : Integer ;  { Declair in VAR section of procedure }
..........
    if ( Application.MessageBox( 'First line of Last Login Log cont
incorrect, Cancel Processing?',
          'Error in Log file', MB_YESNO + MB_ICONERROR ) = ID_YES ) then
Close() ;
  DateChecked := Now ;
  repeat
    Readln( LF, Line ) ;
    BlankIndex := Pos( ' ', Line ) ;
    UserName := Copy( Line, 0, BlankIndex - 1 ) ;
    if ( NOT IsSystemAccount( UserName, SystemLogIns ) ) then
    begin
      WorkStr := StrPos( PChar(Line), NeverLoggedIn ) ;
      if ( WorkStr = nil ) then
        begin   { couldn't find Never Logged In string, set last login
record for this user }
          NewLastLogin := GetLastLogDate( Line ) ;
          NewLstUseIndex := GetNextIndexToLastLogDB ;  { function
!should! assign value to NewLstUseIndex }

...........

          LastUseIndex :=
HiveUserDataModule.LastLoginQueryForUser.FieldValues['LastUseIndex'] ;
          if ( LastUseIndex <> 0 ) then
           begin
            LastLogin :=
HiveUserDataModule.LastLoginQueryForUser.FieldValues['Date_Last_Logon']
;
            if ( LastLogin < NewLastLogin ) then LastLogin :=
NewLastLogin ;
           end
          else
           begin   { This is a new LastLog Record, Get next index value

Quote
}

            LastUseIndex := NewLstUseIndex ;   { I use NewLstUseIndex
here!! but do not have valid value }
            LastLogin := NewLastLogin ;
           end ;
           { set

--
Jon W. Robinson
Principal Scientist
Raytheon ITSS
Code 935
Building 28, Room W192
Goddard Space Flight Center
Greenbelt, MD 20771
301 286-0681 (Phone)
301 286-1776 (FAX)

  robinson.vcf
< 1K Download
 

Re:Delphi 5 Pro lies about my not using variable


Quote
In article <3A3EA7F3.1FDBC...@ltpmail.gsfc.nasa.gov>, Jon Robinson wrote:
> But
> since Delphi 5 doesn't think I am using the variable, it doesn't bother
> saving the value my function returns.  Can anything be done?  See code
> segments below:

Well, I posted your code fragments into the Delphi editor so that I could
reformat them so I could understand but you haven't given enough
information for me to be able to help:

 1) you don't say which variable invokes the compiler error
 2) you do not show a complete routine, thus it is impossible to guess

I suggest that you post a compilable unit into public.attachments and then
I will have another go.

BTW, the correct newsgroup for this type of question is
public.delphi.objectpascal

 Mike Orriss (TeamB & Developer Express)
 (Unless stated otherwise, my replies relate to Delphi 5)
 (No unsolicited e-mail replies please)

Re:Delphi 5 Pro lies about my not using variable


Mike,
   I have sent the whole file to public.attachments.  The problem variable was
identified by {pascal comments} in line with the code.

        Thanks for your help.

        -Jon

Quote
"Mike Orriss (TeamB)" wrote:
> In article <3A3EA7F3.1FDBC...@ltpmail.gsfc.nasa.gov>, Jon Robinson wrote:
> > But
> > since Delphi 5 doesn't think I am using the variable, it doesn't bother
> > saving the value my function returns.  Can anything be done?  See code
> > segments below:

> Well, I posted your code fragments into the Delphi editor so that I could
> reformat them so I could understand but you haven't given enough
> information for me to be able to help:

>  1) you don't say which variable invokes the compiler error
>  2) you do not show a complete routine, thus it is impossible to guess

> I suggest that you post a compilable unit into public.attachments and then
> I will have another go.

> BTW, the correct newsgroup for this type of question is
> public.delphi.objectpascal

>  Mike Orriss (TeamB & Developer Express)
>  (Unless stated otherwise, my replies relate to Delphi 5)
>  (No unsolicited e-mail replies please)

--
Jon W. Robinson
Principal Scientist
Raytheon ITSS
Code 935
Building 28, Room W192
Goddard Space Flight Center
Greenbelt, MD 20771
301 286-0681 (Phone)
301 286-1776 (FAX)

  robinson.vcf
< 1K Download

Other Threads