> Frieder Ferlemann <[EMAIL PROTECTED]> - 2006-12-25 11:19 > Hi, > > "Maarten Brock" <[EMAIL PROTECTED]> schrieb am 25.12.2006 18:18:08: >> What you need is a properly typed copy of the pointer. > > this one should work too: > > gptr = ((unsigned char *) gptr) + 1; > > Mr.Cashe, I'm not sure whether incrementing a parameter > passed to a function is what you want to do? > It's only changed _within_ the function... > > Greetings, > Frieder Thank You, Maarten && Frieder. Yes, both methods works properly and gives identical results. The function in my above post is only sample, real function doing complicated copying and looks like this:
void xcode_write(void xdata * dest, void * src, size_t size) reentrant; This function copies data from anywhere to code(!) area, which in my device placed at external SRAM. However, sdcc forbids writing to the code area and I decided to declare destination pointer with xdata modificator. I had write this function in assembler, so I have no problem with increments now. But I have found this draft: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf Page 59, $6.3.2.3.1 says: "A pointer to void may be converted to or from a pointer to any incomplete or object type. A pointer to any incomplete or object type may be converted to a pointer to void and back again; the result shall compare equal to the original pointer" Page 48, $6.2.5.26 says: "A pointer to void shall have the same representation and alignment requirements as a pointer to a character type (*The same representation and alignment requirements are meant to imply interchangebility as arguments to functions, return values from functions, and members of unions)" Is it still meant the increment code in my first post may not work? What are you think about? Greetings, Mr.Cashe ------------------------------------------------------------------------- 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