RE: err, XLOG/UW711/cc/Doesn't compile. - Mailing list pgsql-hackers

From Peter Eisentraut
Subject RE: err, XLOG/UW711/cc/Doesn't compile.
Date
Msg-id Pine.LNX.4.21.0011201952210.1090-100000@peter.localdomain
Whole thread Raw
In response to RE: err, XLOG/UW711/cc/Doesn't compile.  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
I wrote:

> Mikheev, Vadim writes:
> 
> > > more info.  It seems to not like the following from
> > > src/include/buffer/bufpage.h (line 305):
> > > #define PageSetLSN(page, lsn) \
> > >         (((PageHeader) (page))->pd_lsn = (XLogRecPtr) (lsn))
> > > 
> > > I'm not sure what it's trying to do... 
> > 
> > Just assign values to 8 bytes structure in pageheader.
> 
> It's because XLogRecPtr is a struct.  You can't assign structs with
> '='.  Gotta use memcpy, etc.

Correction:  It's because the compiler won't let you cast to a
struct.  Assigning seems to compile okay.

This code fails to compile:

| typedef struct foo { int a; int b; } foo;
| 
| main() {
|   foo x;
|   (foo) x;
| }

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: RE: err, XLOG/UW711/cc/Doesn't compile.
Next
From: Tom Lane
Date:
Subject: Re: err, XLOG/UW711/cc/Doesn't compile.