standards

C standard regarding pointer arithmetic outside arrays

 ̄綄美尐妖づ 提交于 2021-01-27 04:38:23
问题 I read lot of things about pointer arithmetic and undefined behavior (link, link, link, link, link). It always ends up to the same conclusion: Pointer arithmetic is well defined only on array type and between array[0] and array[array_size+1] (one element past the end is valid with regard to the C standard). My question is: Does it means that when the compiler sees a pointer arithmetic not related to any array (undefined behavior), it could emit what it want (even nothing) ? Or is it more a

The void type in C

眉间皱痕 提交于 2020-12-29 12:10:07
问题 The void type in C seems to be strange from various different situations. Sometimes it behaves like a normal object type, such as int or char , and sometimes it just means nothing (as it should). Look at my snippet. First of all, it seems strange that you can declare a void object, meaning you just declare nothing. Then I created an int variable and casted its result to void , discarding it: If an expression of any other type is evaluated as a void expression, its value or designator is

The void type in C

落爺英雄遲暮 提交于 2020-12-29 12:03:22
问题 The void type in C seems to be strange from various different situations. Sometimes it behaves like a normal object type, such as int or char , and sometimes it just means nothing (as it should). Look at my snippet. First of all, it seems strange that you can declare a void object, meaning you just declare nothing. Then I created an int variable and casted its result to void , discarding it: If an expression of any other type is evaluated as a void expression, its value or designator is

why wasn't the idea of nested functions, implemented in older c++ standard?

让人想犯罪 __ 提交于 2020-12-25 11:44:02
问题 was the idea of nested functions considered to be useless during the time of developing older c++ standard, because its usage is basically covered by another concept like object-oriented programming; or it wasn't implemented just as a matter of simplification? 回答1: Nested functions - to be useful - need the stack frame of the containing function as context. Look at this: class Foo() { void Tripulate() { int i=0; void Dip() { // ... } int x = 12; for(i=1; i<=3; ++i) { int z= 33; Dip(); // ...

why wasn't the idea of nested functions, implemented in older c++ standard?

蓝咒 提交于 2020-12-25 11:32:59
问题 was the idea of nested functions considered to be useless during the time of developing older c++ standard, because its usage is basically covered by another concept like object-oriented programming; or it wasn't implemented just as a matter of simplification? 回答1: Nested functions - to be useful - need the stack frame of the containing function as context. Look at this: class Foo() { void Tripulate() { int i=0; void Dip() { // ... } int x = 12; for(i=1; i<=3; ++i) { int z= 33; Dip(); // ...

why wasn't the idea of nested functions, implemented in older c++ standard?

时光毁灭记忆、已成空白 提交于 2020-12-25 11:29:08
问题 was the idea of nested functions considered to be useless during the time of developing older c++ standard, because its usage is basically covered by another concept like object-oriented programming; or it wasn't implemented just as a matter of simplification? 回答1: Nested functions - to be useful - need the stack frame of the containing function as context. Look at this: class Foo() { void Tripulate() { int i=0; void Dip() { // ... } int x = 12; for(i=1; i<=3; ++i) { int z= 33; Dip(); // ...

why wasn't the idea of nested functions, implemented in older c++ standard?

别等时光非礼了梦想. 提交于 2020-12-25 11:25:40
问题 was the idea of nested functions considered to be useless during the time of developing older c++ standard, because its usage is basically covered by another concept like object-oriented programming; or it wasn't implemented just as a matter of simplification? 回答1: Nested functions - to be useful - need the stack frame of the containing function as context. Look at this: class Foo() { void Tripulate() { int i=0; void Dip() { // ... } int x = 12; for(i=1; i<=3; ++i) { int z= 33; Dip(); // ...

Is it acceptable for a submit button to have a name attribute?

…衆ロ難τιáo~ 提交于 2020-12-10 08:57:40
问题 Usually, a submit button works fine without a name attribute. However, there are occasions where there's a need to have two submit buttons for the same form, hence making use of the name attribute to identify which button was clicked on the server side. To clarify I am talking about: <input type="submit" name="foo"> 回答1: Yes, it is entirely acceptable. The specification has explicit rules for how to determine which submit button was successful, which would be useless if you couldn't give the

Is it acceptable for a submit button to have a name attribute?

扶醉桌前 提交于 2020-12-10 08:55:52
问题 Usually, a submit button works fine without a name attribute. However, there are occasions where there's a need to have two submit buttons for the same form, hence making use of the name attribute to identify which button was clicked on the server side. To clarify I am talking about: <input type="submit" name="foo"> 回答1: Yes, it is entirely acceptable. The specification has explicit rules for how to determine which submit button was successful, which would be useless if you couldn't give the

Are x86 Assembly Mnemonic standarized?

蓝咒 提交于 2020-12-10 05:47:42
问题 Does the x86 standard include Mnemonics or does it just define the opcodes? If it does not include them, is there another standard for the different assemblers? 回答1: Mnemonics are not standardised and different assemblers use different mnemonics. Some examples: AT&T-style assemblers apply b , w , l , and q suffixes to all mnemonics to indicate operand size. Intel-style assemblers typically indicate this with the keywords byte , word , dword , and qword AT&T-style assemblers recognise cbtw ,