Small knowledge FAQ finishing

xiaoxiao2021-03-06  83

[1] Function declaration or definition What is the meaning of __p? EG: int ftp_put __p (argv1, argv2); Compiler (preprocessor) judges in a header file, if it is an ANSI compiler, will __p (x) Defined as X. If it is a compiler that does not support the "Original Function Declaration", __p (x) is defined as (). So, if your compiler does not support "with the original function declaration": int FTP_PUT __P (Argv1, Argv2); will be replaced with: int ftp_put (); such as a function INT F (int, int); some old compilers do not support this statement, to write into int F (); that __p is Used to do this. [2] What is the KOENIG LOOKUP rule? EG: Namespace a {class b {}; void f (const b &) {}}} int main () {a :: b b; f (b); // ok. Lookup Finds A :: f ()} If one or more parameter types of a function is defined in the namespace where the function is located, you can do not have to specify Namespace for this function. This rule is called Koenig Lookup.koeing. For ADL (Argument Dependent Lookup) is only used for non-restricted names, non-restricted name definitions: Yes, except for limited names, ^ _ ^ limited name: Explicit use: or->. The name of the operation symbol access For the restricted name. Another example: Class A {Friend Void Fun () {} // cannot be called outside, the name cannot be found. Friend Void Fun (A P) {} // OK, can be found by parameters can be found in Fun Definitions.}; Int main () {fun (); // Although it can pass on DEV-C , the VC2003 is not linear, this is not standard. // If you change A to a template class, then this The call is in DEV. However, there is a corresponding parameter. A; FUN (A); // OK, DEV-C / VC can be.} [3] macro definition #, ##, # @ problem. #define pr (x) cout << #x; Pr (a) equivalent to: cout << "a";

#define pr (x) cout << ## ax; pr (5) equivalent: cout << a5;

#define pr (x) cout << # @ x; pr (a) equivalent to: cout << 'a'; macro definition: # 叫 引 引 文 ## 做

转载请注明原文地址:https://www.9cbs.com/read-106472.html

New Post(0)