|
I'd have to disagree, especially for present-day systems. There's really no reason to do this; it's a technique intended for small-profile processors (things like mainboard ICs, bootproms, or BIOSes), not full-fledged applications.
I won't deny there are some really good uses for self-modifying code, but most of the time it just adds complexity while adding the benefit of being able to say "my program is cooler than yours."
For lack-of a better example, look at what used to be common practice in the days of 65xxx, 68K, and early x86 -- unrolling loops. This was one of the best ways to gain speed at the cost of size. I've yet to see much of a speed gain using gcc -funroll-loops on any processor other than a 486. :-)
So, my advice would be to sway from going down the path of self-modifying code.
|