🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #318

Re: Can you nest subroutines in C?

#318
From: Robert Barton
Date: Mon, 03 Jul 1989 07:01
34 lines
1206 bytes
 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
Technical Details
Message-ID: <1445@psueea.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!zephyr!tektronix!psueea!jove.cs.pdx.edu!bartonr

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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