M
ma740988
I've got a struct which is comprised of POD types. I know in advance
where in memory the struct resides. To make a long story short, I'm
doing transfers of 16 bit ADC sampled data between 'cards'. At the
front end I configure the memory such that - say card 1 will transfer
data to card 2 at a specified region. A header is accompanied with
each data transfer. So now lets say card 1 transferred the header to
location 0xD0000000 of card2. Assume the header is akin to:
typedef unsigned int uint_type;
struct temp {
uint_type param1;
uint_type param2;
uint_type param3;
// etc
};
To see what's in temp, I do:
temp *ptr_temp = (temp*)0xD0000000; // I already know where to map to.
// now do something with the junk received.
int const p1 = ptr_temp->param1;
As far as I know the approach above is perfectly legal or is this a
candidate for placement new?
Here's my confusion. I'm reading Clines text (yes hard copy of the
FAQ) and I'm tryign to get my head around placement new but I'm not
sure if that buys me anything here.
As always, thanks in advance.
where in memory the struct resides. To make a long story short, I'm
doing transfers of 16 bit ADC sampled data between 'cards'. At the
front end I configure the memory such that - say card 1 will transfer
data to card 2 at a specified region. A header is accompanied with
each data transfer. So now lets say card 1 transferred the header to
location 0xD0000000 of card2. Assume the header is akin to:
typedef unsigned int uint_type;
struct temp {
uint_type param1;
uint_type param2;
uint_type param3;
// etc
};
To see what's in temp, I do:
temp *ptr_temp = (temp*)0xD0000000; // I already know where to map to.
// now do something with the junk received.
int const p1 = ptr_temp->param1;
As far as I know the approach above is perfectly legal or is this a
candidate for placement new?
Here's my confusion. I'm reading Clines text (yes hard copy of the
FAQ) and I'm tryign to get my head around placement new but I'm not
sure if that buys me anything here.
As always, thanks in advance.