Previous Table of Contents "New C Standard" commentary
1799
A
1800
A
1801
A
1802
A function may have any number of
1803
If a
1804 If the expression has a type different from the return type of the function in which it appears, the value is converted as if by assignment to an object having the return type of the function.136)
1805 EXAMPLE In:
struct s { double i; } f(void);
union {
struct {
int f1;
struct s f2;
} u1;
struct {
struct s f3;
int f4;
} u2;
} g;
struct s f(void)
{
return g.u1.f2;
}
/* ... */
g.u2.f3 = f();
there is no undefined behavior, although there would be if the assignment were done directly (without using a function call to fetch the value).
1806
136) The
1807 The overlap restriction of subclause 6.5.16.1 does not apply to the case of function return.
1808
1809
Next
Created at: 2008-01-30 02:39:44
The text from WG14/N1256 is copyright © ISO