Hello,
I'm porting code, previously compiled by IAR compiler, for ARM-gcc compiler.
This snippet results in error, posted in subject:
/*
* copies a structure in a buffer
* pSource Data to copy
* pDest Buffer in which to copy the data
*/
extern inline void copy(void *pSource, void *pDest, unsigned int dLength)
{
unsigned int dI;
for (dI = 0; dI < dLength; dI++) {
*((char *) pDest) = *((char *) pSource);
((char *) pDest)++; /* error */
((char *) pSource)++; /* error */
}
}
As I understand, casting ends up with 'rvalue', and '++' or any other
operations can't be applied to rvalue. So, what is the proper solution here?
I'm unable to find a way :(
Thanks.
With best regards, Roman Mashak. E-mail: mrv@tusur.ru
I'm porting code, previously compiled by IAR compiler, for ARM-gcc compiler.
This snippet results in error, posted in subject:
/*
* copies a structure in a buffer
* pSource Data to copy
* pDest Buffer in which to copy the data
*/
extern inline void copy(void *pSource, void *pDest, unsigned int dLength)
{
unsigned int dI;
for (dI = 0; dI < dLength; dI++) {
*((char *) pDest) = *((char *) pSource);
((char *) pDest)++; /* error */
((char *) pSource)++; /* error */
}
}
As I understand, casting ends up with 'rvalue', and '++' or any other
operations can't be applied to rvalue. So, what is the proper solution here?
I'm unable to find a way :(
Thanks.
With best regards, Roman Mashak. E-mail: mrv@tusur.ru
Comment