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

Content deleted Content added
m Reverted edits by 102.91.4.155 (talk) to last version by Afernand74
 
(7 intermediate revisions by 3 users not shown)
Line 59:
 
: Agreed on separate articles. As a C programmer most of this is really hard to parse. [[Special:Contributions/174.21.162.147|174.21.162.147]] ([[User talk:174.21.162.147|talk]]) 02:47, 16 April 2015 (UTC)
:bc they are mostly the same. I cringe when folks cringe at lumping C and C++ together. We do it since it makes sense! but... (and as they say on GoT, you can ignore everything before but :)) why does this article exist? WP is not a programming manual! Delete this article. [[User:Stevebroshar|Stevebroshar]] ([[User talk:Stevebroshar|talk]]) 13:34, 30 January 2025 (UTC)
 
==order of operations==
Line 202 ⟶ 203:
 
: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 "<ttcode>decltype</ttcode> operator" is frequently used in the proposals. <span style="font-family:monospace, monospace;">[[User:Decltype|decltype]]</span> ([[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 ⟶ 221:
 
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'''''. <ttcode>this</ttcode> 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. <span style="font-family:monospace, monospace;">[[User:Decltype|decltype]]</span> 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)
Line 294 ⟶ 295:
== Overload prototypes ==
 
There's no indication of what the type "R" means. [[User:OrangeDog|OrangeDog]] &nbsp;<small>([[User talk:OrangeDog|τ]] &nbsp; &nbsp;[[Special:Contributions/OrangeDog|ε]])</small> 10:33, 23 June 2010 (UTC)
 
== Compound literals missing ==
Line 321 ⟶ 322:
From [[Operators_in_C_and_C%2B%2B#Notes]]:
 
"* For example, <code>++x*3</code> is ambiguous without some precedence rule(s). The precedence table tells us that: <ttcode>x</ttcode> is 'bound' more tightly to <ttcode>++</ttcode> than to <ttcode>*</ttcode>, so that whatever <ttcode>++</ttcode> does (now or later—see below), it does it ONLY to <ttcode>x</ttcode> (and not to <code>x*3</code>); it is equivalent to (<code>++x</code>, <code>x*3</code>)."
 
<s>This looks like it is saying that <code>++x*3</code> is equivalent to <code>(++x, x*3)</code>. Which is incorrect: with the comma operator, the arguments can be evaluated in any order.</s>
Line 404 ⟶ 405:
 
So, the question is: Should <code>decltype</code> be added to the list of operators? My opinion is that it should, since it does basically the same thing as the typeof operators, so I will be adding it to the page for consistency, but feel free to revert if you can come up with a good counterargument. [[User:Nickps|Nickps]] ([[User talk:Nickps|talk]]) 18:07, 30 October 2023 (UTC)
 
== Is it 4 or 6? ==
 
WRT "...all four relational operators are automatically generated if operator<=> is defined": There are 6 relational operators other than <=>. Either the text should say six instead of four or should list the 4 that it refers to. [[User:Stevebroshar|Stevebroshar]] ([[User talk:Stevebroshar|talk]]) 13:22, 31 January 2025 (UTC)
 
== Is this a list operators? or everything one can say about operators? ==
 
Considering that this article is described as a list of operators, the section '''Expression evaluation order''' seems out of place. It used to be named '''operator precedence''', but I renamed it since it covers more than precedence. Maybe originally it was only about precedence and then someone added associativity which changed the section to be more general: covering evaluation order. Scope creep! Whatever. Regardless, this section does not seem to be covered as part of a list of operators. It should be removed from this article or the intro should say this is all about C/C++ operators; not a list of operators. [[User:Stevebroshar|Stevebroshar]] ([[User talk:Stevebroshar|talk]]) 15:16, 31 January 2025 (UTC)