Path: utzoo!attcan!uunet!zephyr!tektronix!psueea!jove.cs.pdx.edu!bartonr From: bartonr@jove.cs.pdx.edu (Robert Barton) Newsgroups: comp.sys.amiga.tech Subject: Re: Can you nest subroutines in C? Message-ID: <1445@psueea.UUCP> Date: 3 Jul 89 07:01:35 GMT Sender: news@psueea.UUCP Reply-To: bartonr@jove.cs.pdx.edu (Robert Barton) Organization: Dept. of Computer Science, Portland State University; Portland OR Lines: 34 mwm@eris.berkeley.edu (Mike (I'll think of something yet) Meyer) writes: > And it's written entirely in M2? Care to show the M2 to generate an > address exception? The C is simple (and once again, makes assumptions > about the hardware it's running on): > > int *y ; > char x[2] ; > > y = (int *) &x[0] ; > *y = 1 ; > y = (int *) &x[1] ; > *y = 1 ; MODULE Exception; FROM SYSTEM IMPORT ADR; VAR y : POINTER TO INTEGER; x : ARRAY [0..1] OF CHAR; BEGIN y := ADR(x[0]); y^ := 1; y := ADR(x[1]); y^ := 1 END Exception. This works fine with M2Sprint ("fine" meaning generates the exception). (* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- *) P-Link := PDX*BOB bix := robart