Thema: Delphi Comparing functions

Einzelnen Beitrag anzeigen

DevidEspenschied

Registriert seit: 7. Sep 2006
Ort: Berlin
441 Beiträge
 
Delphi 12 Athens
 
#51

Re: Comparing functions

  Alt 5. Nov 2007, 09:10
Zitat von Razor:
As you can see here i was experimenting something and the below looked like is it gonna happen but should i worry about warning?

Delphi-Quellcode:
procedure tmainfrm.amd64x2start;
var
C0:string;
GetInstance:tomcdrv;
pdata: DWord;
begin

       GetInstance.IPCIIORef.GetPCIRDWord(0,24,$03,$E4,pdata);
       GetInstance.IPCIIORef.SetPCIRDWord(0,24,$03,$E4, pdata and not (1 shl 2));
       GetInstance.IPCIIORef.GetPCIRDWord(0,24,$03,$E4,pdata);
       C0:=Format('%d °C',[(pdata shr 16 and $FF)-49]);
       RzLabel99.caption:=C0;

//But then i get [Warning] Temperatures.inc(117): Variable 'GetInstance' might not have been initialized
Thats because TOMCDrv is a class with an initialization routine, which has to be run first. Begin this procedure with GetInstance.Create()

Zitat von Razor:
Delphi-Quellcode:
procedure tmainfrm.amd64x2start;
var
C0:string;

pdata: DWord;
begin

       OMCDRV.tGetPCIRDWord(0,24,$03,$E4,pdata);
       OMCDRV.tSetPCIRDWord(0,24,$03,$E4, pdata and not (1 shl 2));
       OMCDRV.tGetPCIRDWord(0,24,$03,$E4,pdata);
       C0:=Format('%d °C',[(pdata shr 16 and $FF)-49]);
       RzLabel99.caption:=C0;

//But then i get [Fatal Error]Internal error: BA1993 or [Fatal Error] Internal error: L1333
I've never had that kind of error and the documentation doesn't provide any info.

But why don't you create a large class and add there all functions for port reading, msr reading and so on ? Your unit contains a lot of double functions, e.g. 4 or 5 times the readportbyte function. That could be combined into one class to avoid those kind of error messages.
Devid
  Mit Zitat antworten Zitat