, , .
: , UB, , , , , . undefined .
, , , . , , , , . null, .
return *p;
, :
return (int *) p; // no UB here even if p is null!
, : .
. , undefined . , , n1256 C99 n1570 C11, 6.5.3.2 ( ):
Β§4 * ... '' , type ''. , * undefined.
, :
* ...
, , lvalue :
*p[i], , UB, , resul. ,
(return *p;) , , . ( ) :
, & * E E (, E )...
p , .
6.5.2.1 , :
Β§ 3 . E - n- (n Β³ 2) 'j'., 'K, E ( lvalue) (n - 1) - j '., 'K. * , (n - 1) -
IMHO , *p (int *) p, f , .
, , , *, , UB. , , . , , UB, UB , , .
NOTE. I know that comments are not normative, but they are here to help understand the standard. Therefore, when one comment explicitly says that it is &*Eequivalent E(even if it Eis a null pointer), this actually means that, provided that the result is still used for its address, applying the * operator to the null pointer is not necessarily UB.