Talk:Operators in C and C++: Difference between revisions

Content deleted Content added
MalnadachBot (talk | contribs)
m Fixed Lint errors. (Task 12)
Line 177:
--[[User:Der schiefe Turm|Der schiefe Turm]] ([[User talk:Der schiefe Turm|talk]]) 17:04, 16 September 2009 (UTC)
 
:What Derek said. In C, the result of a conditional expression (or ternary expression) is an rvalue even if both the second and third operand are lvalues. <ttspan style="font-family:monospace, monospace;">[[User:Decltype|decltype]]</ttspan> ([[User talk:Decltype|talk]]) 17:12, 16 September 2009 (UTC)
 
::I have to insist: 'gcc (GCC) 3.4.6' compiles with the warning above!!! So if the ternary operator should expand to an rvalue, please show me where to find that in the standards. Anyway, I think this tiny detail only blurs the original message, so here is my proposal: If we change the sample code to "e = a ? b++ : b = d;", C compiler will stop with an error (postfix++ resolves to an rvalue). Plus: Now the code's goal is easier to understand: Either increment, or assign some value! I think there is nothing wrong with me rewriting the section, our discussion whether or not the current version results in an error does not conflict with the improvement. ;-) --[[User:Der schiefe Turm|Der schiefe Turm]] ([[User talk:Der schiefe Turm|talk]]) 15:08, 23 September 2009 (UTC)
:::It's a footnote in Section 6.5.15, as seen [http://www.google.no/search?q=%22A+conditional+expression+does+not+yield+an+lvalue.%22 here]. It's also highlighted in Annex C of the C++ Standard as one of the differences between C++ and C. <ttspan style="font-family:monospace, monospace;">[[User:Decltype|decltype]]</ttspan> ([[User talk:Decltype|talk]]) 15:27, 23 September 2009 (UTC)
::::THNX! --[[User:Der schiefe Turm|Der schiefe Turm]] ([[User talk:Der schiefe Turm|talk]]) 20:15, 23 September 2009 (UTC)
 
Line 202:
 
:The keyword '''typeof''' is a non-standard extension to the C++ language. A similar feature will be provided by the '''decltype''' keyword in [[C++0x]]. The '''throw''' keyword is a standard part of the C++ language. That said, not all keywords are operators, and I am fairly certain that neither '''decltype''' nor '''throw''' would be considered to be operators. ← <span style="font-family: serif;"><b>[[User:Michael Safyan|Michael Safyan]]</b></span><sup>&nbsp;([[User talk:Michael Safyan|talk]])</sup> 02:17, 8 May 2008 (UTC)
::It's a bit confusing, but while [[decltype]] is not explicitly referred to as an operator in the WP, the term "<tt>decltype</tt> operator" is frequently used in the proposals. <ttspan style="font-family:monospace, monospace;">[[User:Decltype|decltype]]</ttspan> ([[User talk:Decltype|talk]]) 17:15, 16 September 2009 (UTC)
 
: "throw" behaves as any other operator, except that it returns void type. The conditional operator has a special case for one operand being a throw-expression, such that "false? 3 : throw xyz()" is an expression of type int that never completes evaluation. [[User:Potatoswatter|Potatoswatter]] ([[User talk:Potatoswatter|talk]]) 09:43, 15 June 2010 (UTC)
Line 220:
 
I see that once again "this" has been removed. Even if technically not an operator, I think it should be here somehow, because I think many will try to find it here. At least could we have a discussion about it instead of an edit war. [[User:SimonTrew|SimonTrew]] ([[User talk:SimonTrew|talk]]) 17:34, 27 February 2009 (UTC)
:Yes, I considered adding a comment on the talk page. But I felt that my edit comment would be enough to settle the issue: '''''removed "this" from the table, per [class.this]/1 of the standard'''''. <tt>this</tt> is not an operator, so I think it's just confusing to have it in a list of operators. Possibly a mention at the bottom of the article, but not in the actual table. Just my 5c. <ttspan style="font-family:monospace, monospace;">[[User:Decltype|decltype]]</ttspan> 19:06, 27 February 2009 (UTC)
 
::Yeah I was kinda thinking the same myself. But actually I am coming round to your opinion and wonder if it is justified at all in this article, it's not difficult to search for. I'm just quite a fan of making cross-references, I think that is part of what gives Wikipedia its value. [[User:SimonTrew|SimonTrew]] ([[User talk:SimonTrew|talk]]) 06:57, 28 February 2009 (UTC)