2 Erik Petrich <[EMAIL PROTECTED]> - 2007-01-03 22:33

Yes, you the rights. I know about arithmetic on void pointers, but I expected 
type-conversion operator will make it possible to deceive the compiler. For 
example, Borland C++ 5.02 and Keil uVision-2 process the following code 
successfully and do what I need:

void func(void *dest, void *src, int size) {
    while (size--) *((char*)dest)++ = *((char*)src)++;
}

But this is erroneous, because standard speaks: "A cast does not yield 
lvalue". This is why nor increment, nor assignments does not work in this 
case. These compilers have strange idea about the precedence of the 
operators. Therefore, gcc and sdcc more correct.

Thank you all.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to