inline? was issn des?
-
Hi,
ich les oft was von inline-funktionen, was sind das? Sind die schneller als normale funktionen?
-
http://www.kuzbass.ru:8086/docs/isocpp/dcl.html#dcl.fct.spec
-2- A function declaration (dcl.fct, class.mfct, class.friend) with an inline specifier declares an inline function. The inline specifier indicates to the implementation that inline substitution of the function body at the point of call is to be preferred to the usual function call mechanism. An implementation is not required to perform this inline substitution at the point of call; however, even if this inline substitution is omitted, the other rules for inline functions defined by dcl.fct.spec shall still be respected.
-
Ist aber wohl eher C++ als ANSI C
-
Original erstellt von MaSTaH:
Ist aber wohl eher C++ als ANSI C??? Nix mit C++, inline ist ANSI-C nach Standard C99!
inline ist lustig. Es verbindet die Vorteile von Makros und Funktionen miteinander. So wird der Code einer inline-Funktion zwar im Code ersetzt, die Parameter werden aber vor der Ersetzung ausgewertet (nicht wie bei Makros!)...
Nur bei großen Funktionen aufpassen: hier kann inline zu großer Codeanschwellung führen.
-
und wenn ich mich recht erinner, war inline nur eine 'Empfehlung' an den Compiler, (oder?). Also es wir nicht zwanghaft so kompiliert.
Grüße Flow
-
Original erstellt von Flow_cplus:
**und wenn ich mich recht erinner, war inline nur eine 'Empfehlung' an den Compiler, (oder?). Also es wir nicht zwanghaft so kompiliert.
**jep!