Autor Beitrag
holgerbremen
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 120



BeitragVerfasst: Do 28.06.07 15:32 
Hallo,

Von C bzw. C++ kenne ich sogenannte Preprocessor-Anweisungen wie #define.


#define max(a,b) ((a)>(b)?(a)/(b))

int main()
{
int c=10;
int d=12;
cout<<max(c,d)<<"\n";
}

D.h., man kann unter anderem Code per #define einmal definieren und so oft verwenden, wie man will. Das spart
natürlich Zeit und macht den Code lesbarer.

Gibts in Delphi was ähnliches?

Gruß
Holger
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: Do 28.06.07 15:37 
Jain ...

Es gibt ne DLangExtension für Delphi, die soetwas ähnliches macht. Häufig schreibt man aber einfach ne entsprechende Funktion, die man einfach aufruft. Ab D9 kann man diese sogar Inlinen und hat damit dann den Effekt von C.

MfG,
BenBE.

_________________
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.
holgerbremen Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 120



BeitragVerfasst: Do 28.06.07 15:40 
DLangExtension ???

Was ist den das? Sagt mir so nichts.

Gruß
Holger
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Do 28.06.07 15:43 

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.