Talk:One Definition Rule
Appearance
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
[edit]The 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
[edit]What'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)
Categories:
- Start-Class Computing articles
- Low-importance Computing articles
- Start-Class software articles
- Unknown-importance software articles
- Start-Class software articles of Unknown-importance
- All Software articles
- All Computing articles
- Start-Class C/C++ articles
- Mid-importance C/C++ articles
- C++ articles
- WikiProject C/C++ articles