Redian新闻
>
前任老板让我帮他review文章
avatar
前任老板让我帮他review文章# Immigration - 落地生根
c*e
1
extern const int MaxElements=10;
Which one of the following statements about the declaration in the sample
area above is true?
a) It defines a global constant variable that can be referenced from other
modules.
b) It references the global constant variable MaxElements declared in
another module.
c) It initializes a variable declared in another module.
d) It retrieves the global constant variable MaxElements declared in another
module.
e) It is only legal within an unnamed namespace.
(9_33 a32_48
avatar
l*7
2
但他只是把文章转给我,让我把review的意见发给他。这样的话,他的信能算review的
邀请信么?
他信里说我比较适合review这篇文章。
谢谢
avatar
x*y
3
b
avatar
g*e
4
no use for your GC application.
avatar
c*e
5
not right.

【在 x***y 的大作中提到】
: b
avatar
J*i
6
不算

【在 l****7 的大作中提到】
: 但他只是把文章转给我,让我把review的意见发给他。这样的话,他的信能算review的
: 邀请信么?
: 他信里说我比较适合review这篇文章。
: 谢谢

avatar
x*y
7
then d? I don't quite the difference between reference and retrieve...

【在 c**********e 的大作中提到】
: not right.
avatar
l*7
8
从editor直接给你的信才算
avatar
j*i
9
I think is a

【在 x***y 的大作中提到】
: then d? I don't quite the difference between reference and retrieve...
avatar
m*s
10
又一个白干活的, 可怜啊
avatar
x*y
11
define? Not sure, declare seems the right word..

【在 j***i 的大作中提到】
: I think is a
avatar
j*t
12
都是被逼的!!
已经干了好多这样的事情了。
avatar
j*i
13
as far as I remember, not sure
In c++ , all built-in declaration is a definition,
const will result internal linkage, but extern turn it to
external linkage.

【在 x***y 的大作中提到】
: define? Not sure, declare seems the right word..
avatar
s*l
14
先攒人品,再提出直接review要求 :)

【在 l****7 的大作中提到】
: 但他只是把文章转给我,让我把review的意见发给他。这样的话,他的信能算review的
: 邀请信么?
: 他信里说我比较适合review这篇文章。
: 谢谢

avatar
c*e
15
This question demonstrates the use of extern and const together.
a) It defines a global constant variable that can be referenced from other
modules.
This is correct (C++ Standard 7.1.1/6). It defines a global constant variable that can be referenced from other modules.
b) It references the global constant variable MaxElements declared in
another module.
This is incorrect. The initializer makes it a definition.See other comments.
d) It retrieves the global constant variable MaxElements declared
avatar
m*n
16
这种评审一点用都没有 我干了很多次 但不算
avatar
x*y
17
Yes, a is correct. I first thought this is used to refer to variables in
other modules....Actually, extern here seems not necessary...

variable that can be referenced from other modules.
comments.
another

【在 c**********e 的大作中提到】
: This question demonstrates the use of extern and const together.
: a) It defines a global constant variable that can be referenced from other
: modules.
: This is correct (C++ Standard 7.1.1/6). It defines a global constant variable that can be referenced from other modules.
: b) It references the global constant variable MaxElements declared in
: another module.
: This is incorrect. The initializer makes it a definition.See other comments.
: d) It retrieves the global constant variable MaxElements declared

avatar
m*k
18
直接跟你老板说,你需要攒评审经验,让他跟编辑推荐你审稿。
你前老板只要稍微有点人味道的,应该就会答应。
要是连这都不答应,那这人也不必帮他忙审稿了
avatar
c*e
19
why extern not necessary? Doesn't it make the variable available to other
compilation unit?

【在 x***y 的大作中提到】
: Yes, a is correct. I first thought this is used to refer to variables in
: other modules....Actually, extern here seems not necessary...
:
: variable that can be referenced from other modules.
: comments.
: another

avatar
s*t
20
I agree with you that extern is not necessary if a) is the answer here

【在 x***y 的大作中提到】
: Yes, a is correct. I first thought this is used to refer to variables in
: other modules....Actually, extern here seems not necessary...
:
: variable that can be referenced from other modules.
: comments.
: another

avatar
M*q
21
I think extern is necessary. "const" by default has internal linkage by c++
rules. "extern" gives it external linkage so that other modules can access
the var.

【在 s*********t 的大作中提到】
: I agree with you that extern is not necessary if a) is the answer here
avatar
x*y
22
By default, the global variable can be shared by all the translate units
except you delcare it as static...
I verified in the programme again, and extern is not necessary....In my
opinion, extern is the storage specifier, as auto, register and static; and
const is the attribute specifier, as volatile, mutable....

【在 c**********e 的大作中提到】
: why extern not necessary? Doesn't it make the variable available to other
: compilation unit?

avatar
t*t
23
const makes namespace scope names internal linkage unless extern is
specified. (3.5 clause 3)

and

【在 x***y 的大作中提到】
: By default, the global variable can be shared by all the translate units
: except you delcare it as static...
: I verified in the programme again, and extern is not necessary....In my
: opinion, extern is the storage specifier, as auto, register and static; and
: const is the attribute specifier, as volatile, mutable....

avatar
x*y
24
Sorry, I made a mistake. You are right. when using const, we must have
extern to make it have the external linkage.

【在 t****t 的大作中提到】
: const makes namespace scope names internal linkage unless extern is
: specified. (3.5 clause 3)
:
: and

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。