Microsoft
Software
Hardware
Network
Question : How to fix assignment of 'ptr to const' to 'ptr' compile error?
typedef struct
{
SRV_Ntrfc_t const *ntrfc;
} SRV_Cnfg_t;
MGR_MR_E srv_main( MGR_MC_E cmd,
MGR_Work_t *cmw,
MGR_Cnfg_t *cmc,
MGR_Srv_t *srv ) {
Work_t *wp = srv->work;
SRV_Cnfg_t *cp = srv->cnfg;
SRV_Ntrfc_t *ntrfc = cp->ntrfc
....
Above code was compiled with WindRiver diab 4.2b 'C' compiler without errors. Compiling this program with WindRiver diab 5.8.0.0 'C' compiler produces the following error:
trying to assign 'ptr to const' to 'ptr'
How to fix this error without changing software functionality? Maybe some kind of typecast may do it.
Answer : How to fix assignment of 'ptr to const' to 'ptr' compile error?
You can use const_cast<type>(), e.g.
ntrfc = const_cast<SRV_Ntrfc_t *>(cp->ntrfc);
Random Solutions
Create an href link within my javascript code
I have a machine having 3 partitions; Windows 7, Linux and HFS+ partition + Paragon capsule. Which tool to have a full backup including MBR?
setup a background worker with a timeout net 2.0
troubleshoot sql tcp - connects locally but not in domain
ASA to Router Ipsec VPN Connection Routing on ASA?
Can I upgrade Windows 2008 Server R2 from evaluation to Fully Purchased version?
Change user name in XP without effecting domain/network
Files Encryption, Platform Windows Server 2008, Windows Vista, Windows XP, Windows 7
group policy scripts
How do I encrypt password so I can save it in registry vb.net