Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site unc.UUCP Path: utzoo!linus!decvax!duke!mcnc!tim@unc.UUCP (Tim Maroney) From: tim@unc.UUCP Newsgroups: net.lang Subject: Re: Self-modifying code Message-ID: <6480@unc.UUCP> Date: Fri, 30-Dec-83 17:29:43 EST Article-I.D.: unc.6480 Posted: Fri Dec 30 17:29:43 1983 Date-Received: Sun, 1-Jan-84 02:07:55 EST References: <319@decvax.UUCP> Organization: CS Dept., U. of N. Carolina at Chapel Hill Lines: 12 In response to the assertion that high-level languages don't allow self-modifying code, I must point out that C's pointer typing freedoms allow the addresses of functions to be converted into pointers to arbitrary data. The self-modification can be done completely in C, although it will be processing machine code, not C. (Needless to say, this requires that the program text not be loaded as read-only.) It is also possible to write complete functions in process memory and transfer control to them, and modify them. -- Tim Maroney, University of North Carolina at Chapel Hill duke!unc!tim (USENET), tim.unc@csnet-relay (ARPA)