Recent

Author Topic: [solved] Switch for warnings off  (Read 1071 times)

Nicole

  • Hero Member
  • *****
  • Posts: 1271
[solved] Switch for warnings off
« on: January 19, 2024, 10:36:15 am »
Code: Pascal  [Select][+][-]
  1. procedure TFrame_CSI.SpeedButton_spot_alleClick(Sender: TObject);
  2. Var GDB_: TVieleKontrakte;
  3.     i, j: integer;   // j verwende ich für eine Funktionszuweisung als Ergebnis
  4.  
  5. begin      
  6.  
  7.    {%H-}            //_______________<<====  soll für j den Hinweis abachalten "is assigned but never used"
  8.  
  9.    GDB_:=nil;
  10.    Frame_CSI.Memo_CSI.lines.Add('Einlesen der spot-Märkte, Daten seit 1984, dauert sehr lange');
  11.  
  12.    GDB_:=CSI.Lies_COTSpot('C:\ua\Files\spot', 'spot', 0);
  13.  
  14.    for i:=Low(GDB_) to high(GDB_) do
  15.       j:=GesDB.NullerTage_kicken(GDB_[i].Kurse);
  16.  
  17.    DB_Kontrakte.WriteSQL_COT (GDB_, 'spot');  
  18.    SetLength(GDB_,0);
  19.  
  20.    {%H+} //_____________________ <<====
  21.  
  22.  
  23. end;

The above method is not very exciting. I have several of this kind.
There is an integer var j.
This j looks unused, - it is not. The value zero says "no error", other values tell to me the kind of error.
So it is for debugging. I use it, the compiler does not.

So he shows me the warning "Var is assigned but never used", annoying in the sum of several methods of this kind.
Usually "never used" is rather important.

my question:
How can I get off the warning in just this very method?

The context menue suggests this ways
Code: Text  [Select][+][-]
  1. Hide message by Inserting {%H-}
  2. Hide Message by inerting {warn 2027 off} to unit frame_csi.pas
  3. Verbergen mit der Projekt-Einstellung (-vm5027)


I tried, but it does not work.
What do I have to change, that it DOES work?
Again: I just want it to be off for this group of lines and "j".
« Last Edit: January 19, 2024, 01:52:29 pm by Nicole »

Fibonacci

  • Hero Member
  • *****
  • Posts: 788
  • Internal Error Hunter
Re: Switch for warnings off
« Reply #1 on: January 19, 2024, 10:43:42 am »
In the IDE in the editor in the line with the warning you will see a yellow triangle, right click it and choose hide warning, it will place {%H+} in the right place.

bytebites

  • Hero Member
  • *****
  • Posts: 754
Re: Switch for warnings off
« Reply #2 on: January 19, 2024, 11:37:04 am »
Code: Pascal  [Select][+][-]
  1. {$push}
  2. {$warn 5027 off}
  3. procedure TFrame_CSI.SpeedButton_spot_alleClick(Sender: TObject);
  4. Var GDB_: TVieleKontrakte;
  5.     i, j: integer;   // j verwende ich für eine Funktionszuweisung als Ergebnis
  6.  
  7. begin      
  8.  
  9.  
  10.    GDB_:=nil;
  11.    Frame_CSI.Memo_CSI.lines.Add('Einlesen der spot-Märkte, Daten seit 1984, dauert sehr lange');
  12.  
  13.    GDB_:=CSI.Lies_COTSpot('C:\ua\Files\spot', 'spot', 0);
  14.  
  15.    for i:=Low(GDB_) to high(GDB_) do
  16.       j:=GesDB.NullerTage_kicken(GDB_[i].Kurse);
  17.  
  18.    DB_Kontrakte.WriteSQL_COT (GDB_, 'spot');  
  19.    SetLength(GDB_,0);
  20.  
  21.  
  22.  
  23. end;
  24. {$pop}
  25.  

MarkMLl

  • Hero Member
  • *****
  • Posts: 8504
Re: Switch for warnings off
« Reply #3 on: January 19, 2024, 12:01:21 pm »
I tried, but it does not work.

Use the IDE to insert a directive. The positioning is crucial, so at least until you're used to it don't attempt to do it by hand.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Nicole

  • Hero Member
  • *****
  • Posts: 1271
Re: Switch for warnings off
« Reply #4 on: January 19, 2024, 01:43:42 pm »
Have it, thank you so much!
The IDE did it for me, this is the way for it

Var    i, {%H-}j: integer;
« Last Edit: January 19, 2024, 01:51:53 pm by Nicole »

paweld

  • Hero Member
  • *****
  • Posts: 1487
Re: [solved] Switch for warnings off
« Reply #5 on: January 19, 2024, 01:55:53 pm »
From the context menu on the message, select Hide message by inserting IDE directive {%H-}.
Best regards / Pozdrawiam
paweld

 

TinyPortal © 2005-2018