Path: utzoo!attcan!uunet!zephyr.ens.tek.com!tektronix!nosun!qiclab!m2xenix!puddle!f101.n273.z1.fidonet.org!Peter.M..Perchansky From: Peter.M..Perchansky@f101.n273.z1.fidonet.org (Peter M. Perchansky) Newsgroups: comp.lang.modula2 Subject: Re: JPI M2 2.00 - PROCEDURE FUNCTIONS & ERROR CHECKING Message-ID: <2607.26B7D08F@puddle.fidonet.org> Date: 30 Jul 90 14:52:04 GMT Sender: ufgate@puddle.fidonet.org (newsout1.26) Organization: FidoNet node 1:273/101 - Schizophrenia, Fleetwood PA Lines: 47 Hello David: In a msg dated 26 Jul 90 01:12:39, David Hinds said: **********************BEGIN QUOTE***************************** From: dhinds@portia.Stanford.EDU (David Hinds) Date: 24 Jul 90 06:05:19 GMT Organization: AIR, Stanford University Message-ID: <1990Jul24.060519.23417@portia.Stanford.EDU> Newsgroups: comp.lang.modula2 I would be very surprised to see a compiler that flagged the above routine as an error. I don't think that leaving the possibility of reaching the end of a procedure without a RETURN statement violates the syntax of M2 - am I wrong? If I'm right, then there is no way for the compiler, in the general case, to determine if the illegal exit might ever be executed. Sure, it could test for some trivial cases like the one in the example, but it seems pointless. The runtime trap can catch infinitely more cases of illegal exits than the compiler ever could. I guess the compiler could easily enough make sure that a procedure has at least one RETURN statement that could be reached, but beyond that, the problem is insurmountable. A compiler could require that all execution paths end in RETURN statements, but that is still a non-trivial extension to the language syntax. ***********************END QUOTE****************************** JPI TopSpeed Modula-2 1.17 issued a compile-time error; so it is possible. JPI TopSpeed Modula-2 2.00 issues a run-time error. -- uucp: uunet!m2xenix!puddle!273!101!Peter.M..Perchansky Internet: Peter.M..Perchansky@f101.n273.z1.fidonet.org