From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2003-08-27 23:43:36
On Wed, Aug 27, 2003 at 11:22:14PM +0200, Groepaz wrote: > ooooohhh ... so sth like *(char*)0x8000=0 is infact undefined and just happens > to access memory address 0x8000 on a lot of machines/targets (but it could > access address 0x1234 on some other imaginary one) ? Yes, with one minor correction: It is not undefined, but "implementation defined". "unspecified behavior" means that the standard provides several possibilities, where the implementation is free to choose one of them. "implementation defined behavior" means that the implementation has to document the way, a feature is implemented. "undefined behavior" means that there are no restrictions, so the compiler may generate predictable results, generate wrong code, crash, start world war III or whatever. In the case of "*(char*)0x8000=0", compiler writers seem to agree that this notation is the natural one to access the contents of the memory at address 0x8000 - but this is not required by the standard. All three do mean that a program using such a feature is non portable (which is obvious in the case of *(char*)0x8000=0). Regards Uz -- Ullrich von Bassewitz uz_at_musoftware.de ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo_at_musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.
This archive was generated by hypermail 2.1.3 : 2003-08-27 23:46:37 CEST