C Coding Tips
Betta jin
<
Betajin@hotmail.com>
April 15, 2002
Chapter1. Coding Styles
Section1. Let Global Function Body In Header File
THE 'INLINE' Keyword: Inline void Hello () {...} - or -class chello {public: void sayhello (); ...}; inline chello :: syphoreo () {...}
Note: this style let the compiler know That The Function SHOULD BE ONLY ONCE
Instance Ingnoring WHETHER THE FUNCTION CAN Indeed To BE Inlined, And
Make The Linker Happy To Link Correctly.
The 'Friend Static Inline' Modifier: // xxx.h # prgma lords chello {Friend Static Inline Void Sayello (Chello * P) {Assert (p! = 0); std :: cout << p-> m_val; .. } ... protected:; // main.cpp # include "xxx.h" int main () {chello ohello; sayhello (& ohello); return 0;}
Note: Any function modified by friend is global.