I have two structures rom and transfer.
typedef struct
{
const uint32 data;
}rom;
typedef struct
{
const rom* const read;
}transfer;
extern const transfer num;
In another C program I have declared
transfer* count;
and
count = (transfer*)(*((uint32*)((uint32)&num) + 2*seqno));
Above code compiles in gcc compiler. But when I include extern "C" {}, save the file as .cpp and building with g++ compiler it throws me an error. Since direct type cast is not possible with g++ compiler. the error is
error: cast from 'const transfer*' to 'uint32{{aka unsigned int}' loses precision [-fpermissive]
How could we typecast for c++ compiler?