This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Compiling GCC With a C++ Compiler (g++)



On 13/10/2004, at 8:23 AM, Dave Korn wrote:


-----Original Message-----
From: Joseph S. Myers
Sent: 13 October 2004 15:10

Without "restrict" the only relevant undefined behavior is if
the object
is *defined* with qualified type (6.7.3#5).  This can apply
with static or
automatic storage duration declarations such as

struct { const char x } y = { z };

but cannot apply to an object of allocated storage duration.

Huh? Are you saying that in:


typedef struct { const char x } AA;

AA *py1, py2;
AA y1 = { z };

  py1 = malloc (sizeof *py2);
  py2 = &y1;

it is valid to say

*(char *)(&py1->x) = '?';

but not valid to say

*(char *)(&py2->x) = '?';

Yes, that sounds right.


As a simpler example, given

static const int x = 3;
static int y = 4;

it is valid to say

*(int *)(const int *)&y = 4;

but not

*(int *)(const int *)&x = 4;

Attachment: smime.p7s
Description: S/MIME cryptographic signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]