standards

Weird behaviour of prefix and postfix operators

自闭症网瘾萝莉.ら 提交于 2019-12-22 09:25:29
问题 Why is the first expression allowed, but the second not: void test() { int a; ++a = getSomeInt(); a++ = getSomeInt(); } I mean, why its forbidden for the second one to be an lvalue ? The second one makes sense and the first not. In the first one we increment the variable and immediately after we gave here a new value, we lose it. That's not the case in the second expression. It makes sense to assign some value and increment the variable after that. 回答1: The result of postfix increment is

UNION ALL two SELECTs with different column types - expected behaviour?

≡放荡痞女 提交于 2019-12-22 08:15:22
问题 What is the expected behaviour due to SQL Standard when we perform UNION on two tables with different data types: create table "tab1" ("c1" varchar(max)); create table "tab2" ("c3" integer); insert into tab1 values(N'asd'), (N'qweqwe'); insert into tab2 values(123), (345); select c_newname as myname from ( select "c1" as c_newname from "tab1" union all select "c3" from "tab2" ) as T_UNI; MS SQL Server gives Conversion failed when converting the varchar value 'asd' to data type int. but what

C# IComparer<T> standard usage question

狂风中的少年 提交于 2019-12-22 07:57:13
问题 I have a question with whether or not this is a standard for using IComparer in C#. Say I have a situation in which there are three Person objects: P1, P2, and P3. Say I call the Compare method passing in P1 and P2 and the result is 0. This essentially means the two people should be categorized as equal. Now say I call the Compare method passing in P2 and P3 and the result for that is 0 as well. Again, this means the two people are equal. Logically speaking, one can assume P1 and P3 are equal

Are assignment operators “required” to return?

我怕爱的太早我们不能终老 提交于 2019-12-22 04:33:42
问题 According to the C++ standard, can I be sure that assignment operators for built-in variables return (the original value)? Or is this implementation dependent (yet simply have most popular compilers implemented this)? 回答1: Yes, it is guaranteed: 5.17 Assignment and compound assignment operators The assignment operator (=) and the compound assignment operators all group right-to-left. All require a modifiable lvalue as their left operand and return an lvalue referring to the left operand .

Are assignment operators “required” to return?

三世轮回 提交于 2019-12-22 04:33:12
问题 According to the C++ standard, can I be sure that assignment operators for built-in variables return (the original value)? Or is this implementation dependent (yet simply have most popular compilers implemented this)? 回答1: Yes, it is guaranteed: 5.17 Assignment and compound assignment operators The assignment operator (=) and the compound assignment operators all group right-to-left. All require a modifiable lvalue as their left operand and return an lvalue referring to the left operand .

Will a C conditional always return 1 or 0?

佐手、 提交于 2019-12-22 04:04:44
问题 Do C conditional statements always return [1 or 0], or do they return [0 or 'something other than zero']. I ask because: pseudo code - foo(address, shouldSend): register >>= 1 register <<= 1 // to clear bit in first position register |= shouldSend // to signal whether it should send or not the problem occurs if somebody passin IN a shouldSend value of true greater than one (as only 0 is false and all else is true, technically this is valid). since i am directly OR'ing the truth value of

In the C++ standard, where does it indicate the spacing protocol for the replacement of category descriptives by the source code it represents?

孤人 提交于 2019-12-22 03:51:01
问题 At the risk of asking a question deemed too nit-picky, I have spent a long time trying to justify (as a single example of something that occurs throughout the standard in different contexts) the following definition of an integer literal in §2.14.2 of the C++11 standard, specifically in regards to one detail, the presence of whitespace in the syntax notation itself. (Note that this example - the definition of an integer literal - is not the point of my question. The point of my question is to

Is XForms still a live standard?

我怕爱的太早我们不能终老 提交于 2019-12-22 03:48:26
问题 The XForms standard page seemed to indicate that it was no longer live, and that html5 kinda sorta does the job now. Is this the case? I'm looking at storing heterogenous data nuggets as XML fragments - generating a editor page according to the datatype. 回答1: To add to Phil's answer: The XForms Working Group at W3C is active and currently working on XForms 2.0. See in particular the proposed 2.0 features on the wiki and the in-progress draft of the spec as of Feburary, 2012. Also I don't

Does the C++11 standard formally define acquire, release, and consume operations?

怎甘沉沦 提交于 2019-12-22 01:38:03
问题 In the C++11 standard, section 1.10/5 mentions, but does not formally define the terms acquire operation , release operation , and consume operation . It then goes on in Section 29 to use these terms to describe the actions of certain memory orderings, atomic operations, and memory fences. For instance, 29.3/1 on "Order and Consistency" states: memory_order_release , memory_order_acq_rel , and memory_order_seq_cst : a store operation performs a release operation [emphasis added] on the

std::is_trivially_copyable - Why are volatile scalar types not trivially copyable?

我的未来我决定 提交于 2019-12-22 01:25:57
问题 The current standards for C++17 (and I've observed similar wording for C++11) have very confusing wording for trivially copyable types. I first stumbled upon this problem with the following code (GCC 5.3.0): class TrivialClass {}; std::is_trivially_copyable<int volatile>::value; // 0 std::is_trivially_copyable<TrivialClass volatile>::value; // 1 ?? Making the confusion even worse, I tried checking to see what std::is_trivial had to say about the matter, only being brought to more confusion.