c++ - passing argument 2 of 'memcpy' discards 'volatile' qualifier from pointer target type -
i have volatile char * start_address;
pointing register sections (might change due hardware behavior). need read , using:
memcpy ( result_p, // starting address of destination start_address, // starting address of source result_len // length of payload );
i getting warning:
passing argument 2 of '
memcpy
' discards 'volatile
' qualifier pointer target type
is safer way read sections or better way use memcpy , prevent warning?
memcpy
incompatible volatile objects, , mismatched pointer type in function signature helping point out you. memcpy
may copy in order, in unit size, read parts of source multiple times, write parts of destination multiple times, etc. on other hand, volatile
expresses intent sequence , number of accesses object must in abstract machine. if want copy volatile
arrays, need write own copy loop looks naive memcpy
, , use right volatile
type pointer in loop.
Comments
Post a Comment