As Weddington, Eric wrote: > I would say that that comparison is unfair. This is nothing so > dangerous as self-modifying code. Just because both are unobvious, > doesn't make them equivalent situations.
Well, the self-modifying code wasn't really dangerous either. It's only been unobvious (to the innocent observer -- it's been state of the art by that time, to some degree). The instructions were carefully chosen, and the assembly code used labels to refer to them (rather than manually counted byte offsets or such). So it's not quite that unfair, self-modifying code is just no longer "in fashion" (and quite hard to get at on a Harvard machine anyway :). > The idea is that you want to make the compiler do as much as > possible. If it doesn't matter where something should go (like a > scratch register), then let the compiler pick it for you as it knows > more about the state of the code. But the compiler also does exactly that if you spend a syntactical scratch register to the inline asm statement. The generated code is not really different; it's just more obvious to the innocent reader. It's still the compiler who selects what register to pick, and the compiler does that based on the situation around the actual call to that inline asm statement. I'm tired enough now, both by day time as well as the length of this discussion. ;-) If you feel your version is safe, go ahead, but I've got the impression you weren't so confident about its safety, so that that triggered your question in the first place. -- cheers, J"org .-.-. --... ...-- -.. . DL8DTL http://www.sax.de/~joerg/ NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-) _______________________________________________ AVR-libc-dev mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/avr-libc-dev
