Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!math.fu-berlin.de!uniol!sol.north.de!skuld!core!peic From: peic@core.north.de (Peter Eichler) Newsgroups: comp.sys.amiga.programmer Subject: Re: Self modifying code Message-ID: <1937d05e.ARN00ce@core.north.de> Date: 29 May 91 17:30:22 GMT References: <5005@orbit.cts.com> <1991May28.120630.10150@cs.umu.se> Reply-To: peic@core.north.de (Peter Eichler) Followup-To: comp.sys.amiga.programmer Organization: Private UUCP-Site Lines: 27 In article <1991May28.120630.10150@cs.umu.se>, Joakim Rosqvist writes: >Ok, I have heard before that you should not use self modifying code. >Can anybody give a good reason for this, besides it being bad programming >pratice. >I just got the RKM manuals and they only stated "for compatibilty with >010/020/030 etc. don't use selfmodifying code" >/$DR.HEX$ Self modifying code is in no way reentrent and therefore cannot be made pure. For OS procedures, handlers, devices, etc. this methode is DEADLY. Imagine a self modifing compiler and you use the "Resident" command... Also there is a non-determenistic behavour. If you do not reset the code you mostly are not able to produce the same results. Maybe you will get side effects. Programs with self modifying code are ugly to handle during debugging time and hard to keep it "clean". *Sometimes* self-modifyng code is a little faster than other equivalent code, but this advantage is very little so no one should use this in common applications!!! Peter (a lonesome guy with a lonesome amiga at the armpit of the universe, called Germany...)