问题 单项选择题

下面说法正确的是

A.内联函数在运行时是将该函数的目标代码插入每个调用该函数的地方

B.内联函数在编译时是将该函数的目标代码插入每个调用该函数的地方

C.类的内联函数必须在类体内定义

D.类的内联函数必须在类体外通过加关键字inline定义

答案

参考答案:B

解析: 内联函数用inline修饰,用于取代C语言中的宏定义。Inline是个建议机制而不是强制机制,也就是说,程序员可以指定任意函数为inline函数,但是编译器会根据系统情况来决定是否将其inline处理。对于较大的函数,编译器往往会取消其inline特性。Inline:函数的特点之一就是执行速度快,他实质是在编译时将函数的目标代码插入到每个调用该函数的地方,从而没有出栈入栈、保护现场等开销,提高了效率。在类体内定义的成员函数,自动被编译器当做内联函数处理,在类体外定义的成员函数,如果用inline修饰,编译器也认为是一种内联建议。

单项选择题

The following questions present a sentence, part of which or all of which is underlined. Beneath the sentence, you will find five ways of phrasing the underlined part. The first of these repeats the original; the other four are different. If you think the original is best, choose the first answer; otherwise choose one of the others.

These questions test correctness and effectiveness of expression. In choosing your answer, follow the requirements of standard written English; that is, pay attention to grammar, choice of words, and sentence construction. Choose the answer that produces the most effective sentence; this answer should be clear and exact, without awkwardness, ambiguity, redundancy, or grammatical error.

Approximately $120 billion in venture capital is estimated as having poured into technology, stocks during the late 1990s, creating a valuation bubble that burst in 2000.()

A. Approximately $120 billion in venture capital is estimated as having poured into technology stocks during the late 1990s, creating

B. During the late 1990s approximately $120 billion in venture capital is estimated to have poured into technology stocks and created

C. During the late 1990s it is estimated that there was approximately $120 billion in venture capital that was poured into technology stocks, creating

D. It is estimated that during the late 1990s, approximately $120 billion in venture capital poured into technology stocks, creating

E. It is estimated that there was approximately $120 billion in venture capital that poured into technology stocks during the late 1990s and created

单项选择题