three problems of C... a little bit long but not complex.......

S

stsnaiv

what's the composite type of two sturct/union?
such as

struct f bar;
struct f
{
int member;
}bar;


it will produce a composite type? what's that?


______________________________________________________


C11 6.5p7 says that

An object shall have its stored value accessed only by an lvalue expressionthat has one of
the following types:
88)
— a type compatible with the effective type of the object,
— a qualified version of a type compatible with the effective type of theobject,
— a type that is the signed or unsigned type corresponding to the effective type of the
object,
— a type that is the signed or unsigned type corresponding to a qualifiedversion of the
effective type of the object,
— an aggregate or union type that includes one of the aforementioned types among its
members (including, recursively, a member of a subaggregate or contained union), or
— a character type.

The intent of this list is to specify those circumstances in which an object may or may not be aliased

so my question is what is "be aliased" ?? An object how to access using above ways?? here i can't get through so far.....


_____________________________________________



C11 6.5.2.2p10 says that
Every evaluation in the calling function (including
other function calls) that is not otherwise specifically sequenced before or after the
execution of the body of the called function is indeterminately sequenced with respect to
the execution of the called function.

what this means??


6.5.2.p2 says that

With respect to an indeterminately-sequenced function call, the operation of postfix++is a single evaluation.

and 6.5.16.2p3 says that

Acompound assignmentof the form E1op=E2 is equivalent to the simple assignment expression E1 = E1op(E2), except that the lvalue E1is evaluated only once, and with respect to an indeterminately-sequenced function call, theoperation of a compound assignment is a single evaluation.


for example?? And what is the difference between indeterminately-sequencedand unsequenced??


Thanks everyone......
 
S

Stephen Sprunk

C11 6.5.2.2p10 says that Every evaluation in the calling function
(including other function calls) that is not otherwise specifically
sequenced before or after the execution of the body of the called
function is indeterminately sequenced with respect to the execution
of the called function.

what this means??

Take this example:

a = foo() + bar();

We don't know whether foo() or bar() will be called first, but it is
guaranteed that the first one will finish executing before the second
one starts executing.
And what is the difference between indeterminately-sequenced and
unsequenced??

Unsequenced would allow foo() and bar() to execute at the same time.

Indeterminately sequenced means the events are sequenced but we don't
know what that sequence is.

S
 
S

Stephen Sprunk

C11 6.5p7 says that

An object shall have its stored value accessed only by an lvalue
expression that has one of the following types:
88)
— a type compatible with the effective type of the object,
— a qualified version of a type compatible with the effective type
of the object,
— a type that is the signed or unsigned type corresponding to the
effective type of the object,
— a type that is the signed or unsigned type corresponding to a
qualified version of the effective type of the object,
— an aggregate or union type that includes one of the aforementioned
types among its members (including, recursively, a member of a
subaggregate or contained union), or
— a character type.

The intent of this list is to specify those circumstances in which
an object may or may not be aliased

so my question is what is "be aliased" ?? An object how to access
using above ways?? here i can't get through so far.....

Aliasing means one object may be accessed via multiple names. For instance:

int p;
int *q = &p;

In this case, *q is an alias of p: they refer to the same object. They
also happen to be of type (int), but the above list allows an alias to
have certain other types as well.

S
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top