Talk:One Definition Rule
Latest comment: 5 years ago by BernardoSulzbach in topic First Paragraph
This is the talk page for discussing improvements to the One Definition Rule article. This is not a forum for general discussion of the article's subject. |
Article policies
|
Find sources: Google (books · news · scholar · free images · WP refs) · FENS · JSTOR · TWL |
This article is rated Start-class on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | |||||||||||||||||||||||||||
|
First Paragraph
editThe first paragraph of this page is "ODR is important in C++". This is not a good description of this page. Wikipedia's Wikipedia:Manual of Style/Lead section page of the manual gives some guidelines about it. The first paragraph should be an introduction to the article and a brief summary.
I'm still trying to understand ODR, so I'm not the best person to make this edit.
- Well noticed. I tried to summarize the core of the rule in the lead. BernardoSulzbach (talk) 13:10, 28 November 2019 (UTC)
Untitled
editWhat's the problem with the last snippet? The statement is incorrect: that code compiles even in pre-C++0x compliant compilers. Dgutson (talk) —Preceding undated comment added 19:38, 15 April 2009 (UTC).
- It does, but according to the standard it is ill-formed. The reason for this is the wording of [basic.defs.odr]/2: "An expression is potentially evaluated unless it appears where an integral constant expression is required ... An object or non-overloaded function is used if its name appears in a potentially-evaluated expression". According to this, the static data member is clearly used in the example. Furthermore, "Every program shall contain exactly one definition of every non-inline function or object that is used in that program; no diagnostic required", in essence, even if it is ill-formed, the compiler does not have to warn about it, but the resulting program has undefined behaviour. decltype (talk) 20:25, 15 April 2009 (UTC)