Autor Beitrag
RedBaron2k7
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 25

SuSE Linux, Windows XP
BDS06
BeitragVerfasst: Sa 18.08.07 14:17 
Hi .... habe folgendes Problem ...

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
function TuWas(var max_x: Integer; ...): string;
begin
  {$HINTS OFF}
  {$WARNINGS OFF}
    max_x := temp_max_x;
    max_y := temp_max_y;
    max_z := temp_max_z;
    min_x := temp_min_x;
    min_y := temp_min_y;
    min_z := temp_min_z;
  {$WARNINGS ON}  
  {$HINTS ON}
end;


Nun bekomme ich dauernd den Hinweis:
Zitat:
[DCC Warnung] obj_import.pas(802): H2077 Auf 'max_y' zugewiesener Wert wird niemals benutzt


Obwohl ich diese meldung doch eingentlich unterdrücke ...

langsam nervt es ...

der wert wird der variablen in der funktion zugewiesen .... das muss doch reichen ...

und die funktion wird aufgerufen, und die werte dann in ner anderen unit genutzt ...

*grumml*

kann mir jemand erklären, wie ich das unterdrücke .... ohne erst noch sowas wie

max_x := max_x;
einzusetzen ^^
Regan
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2157
Erhaltene Danke: 72


Java (Eclipse), Python (Sublimetext 3)
BeitragVerfasst: Sa 18.08.07 14:35 
Wieso willst du diese Warnungen unterdrücken? Ich irgnoriere sie schlicht.
Timosch
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1314

Debian Squeeze, Win 7 Prof.
D7 Pers
BeitragVerfasst: Sa 18.08.07 14:46 
user profile iconRegan hat folgendes geschrieben:
Wieso willst du diese Warnungen unterdrücken? Ich irgnoriere sie schlicht.

Das ist nicht gerade konstruktiv... :) Ich ignoriere sie zwar auch, und sonderlich störend sind sie eigentlich nicht, aber im Prinzip müssten die Warnungen über genannte Compileroptionen abgestellt werden. Warum sie trotzdem noch da sind, verstehe ich nicht... 8)

_________________
If liberty means anything at all, it means the right to tell people what they do not want to hear. - George Orwell
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Sa 18.08.07 14:53 
Versuche mal, das Warnings on hinter das End; zu setzen. Erst am Ende der Funktion kann sich der Compiler sicher sein, dass die Variablen auch wirklich nicht benutzt wurden.

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Sa 18.08.07 15:01 
Probier mal aus var -> out (out max_x: Integer;) zu machen. Dann sollte keine Meldung mehr kommen.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
RedBaron2k7 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 25

SuSE Linux, Windows XP
BDS06
BeitragVerfasst: Sa 18.08.07 18:29 
wooohooo

thx .... die letzten beiden genannten lösungen funktionieren :)

aber der fehler war sogar noch einfacher ... ich hab in der funktions-deklaration die var's vergessen -.-
dummzeuch
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 593
Erhaltene Danke: 5


Delphi 5 ent, Delphi 6 bis Delphi XE8 pro
BeitragVerfasst: Sa 18.08.07 19:39 
user profile iconRedBaron2k7 hat folgendes geschrieben:
aber der fehler war sogar noch einfacher ... ich hab in der funktions-deklaration die var's vergessen -.-


... soviel zum Thema "warnings ignorieren"...

Warnings sollte man nie ignorieren und schon gar nicht abschalten. Es gibt nur wenige Faelle, wo der Compiler wirklich rumspinnt, meistens hat eine Warning und oft auch ein Hint einen Grund, den man suchen sollte. Hints maskieren meistens eine Warning an einer anderen Stelle.
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Sa 18.08.07 19:45 
Auch wenn es nun mit var funktioniert, sollte man IMHO out verwenden, da das dafür gemacht ist.


EDIT: Scheinbar doch net ^^

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Regan
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2157
Erhaltene Danke: 72


Java (Eclipse), Python (Sublimetext 3)
BeitragVerfasst: So 19.08.07 08:56 
user profile icondummzeuch hat folgendes geschrieben:
Warnings sollte man nie ignorieren und schon gar nicht abschalten.

Aber wenn mir der Compiler als Warnung ausgibt: Variable "n" wurde deklariert und in procedure xyz nicht verwendet, dann ist das doch nicht so schlimm, nur weil ich da einen Codefetzen mal auskommentiert habe.