Self-modifying code: Difference between revisions

Content deleted Content added
CE
Line 4:
{{Use list-defined references|date=December 2021}}
{{Use American English|date=January 2019}}
In [[computer science]], '''self-modifying code''' ('''SMC''' or '''SMoC''') is [[Sourcesource code|code]] that alters its own [[instruction (computer science)|instructions]] while it is [[execution (computers)|executing]] – usually to reduce the [[instruction path length]] and improve [[Computercomputer performance|performance]] or simply to reduce otherwise [[Duplicateduplicate code|repetitively similar code]], thus simplifying [[Softwaresoftware maintenance|maintenance]]. The term is usually only applied to code where the self-modification is intentional, not in situations where code accidentally modifies itself due to an error such as a [[buffer overflow]].
 
Self-modifying code can involve overwriting existing instructions or generating new code at run time and transferring control to that code.