Autor Beitrag
Smartie
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 205



BeitragVerfasst: Mo 04.07.05 08:59 
Hallo,

ok, inzwischen beider Kosmetik angelangt, sollte mein Teilprojekt bissel schönes aussehen, bevor es ins große Projket eingebunden wird.

Mein Hauptproblem: Ich habe hier HAUFENWEISE globaler Variablen.
Gut, jetzt mal ganz doof, wenn ich Rückgabewerte ausgeben möchte, sollte ich ja aus einigen meiner Prozeduren Funktionen machen.
Nur, wie mache ich das, wenn ich merh als einen Rückgabewert habe? Wie übergebe ich das in eine Prozedur wenn ich das Ding ausführe, ohne auf globale Variablen zurückzugreifen?

Herzlichsten Dank und Gruß


Smartie
uall@ogc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1826
Erhaltene Danke: 11

Win 2000 & VMware
Delphi 3 Prof, Delphi 7 Prof
BeitragVerfasst: Mo 04.07.05 09:04 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
procedure blub(var a,b,c: integer);
begin
  a := a*2;
  b := b*b;
  c := c/2;
end;


procedure main;
var a,b,c: integer;
begin
  a := 1;
  b := 2;
  c := 3;
  blub(a,b,c);
end;

_________________
wer andern eine grube gräbt hat ein grubengrabgerät
- oder einfach zu viel zeit
Smartie Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 205



BeitragVerfasst: Mo 04.07.05 09:15 
Alles klar, herzlichen Dank! Bisher habe ich imemr nur Variablen an eine Prozedur weitergegeben, noch nie umgekehrt, nur bei Funktionen.

Dabei ist es so simpel *An Hirn fass*

Gruß und Danke


Smartie
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Mo 04.07.05 12:41 
Ergänzung:
Es gibt noch zwei weitere Möglichkeiten:

ausblenden Delphi-Quelltext
1:
Procedure blub(ain, bin, cin: Integer; out aout, bout, cout: Integer);					

Wobei aout, bout und cout vom Compiler am Anfang der Routine als undefiniert betrachtet werden.

Oder per Record:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
type TResult = record
    A, B, C: Integer;
end;

function blubb(InParams:ParamList): TResult;

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.