Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!eecae!cps3xx!rang
From: rang@cpsin3.cps.msu.edu (Anton Rang)
Newsgroups: comp.lang.pascal
Subject: Re: Extended Pascal: Lack of Pragmas :-(
Message-ID: <1263@cps3xx.UUCP>
Date: 8 Dec 88 17:05:02 GMT
References: <950013@hpclscu.HP.COM>
Sender: usenet@cps3xx.UUCP
Reply-To: rang@cpswh.cps.msu.edu (Anton Rang)
Organization: Michigan State University, Computer Science Dept.
Lines: 38
In-reply-to: shankar@hpclscu.HP.COM's message of 8 Dec 88 00:30:26 GMT

In article <950013@hpclscu.HP.COM>, shankar@hpclscu.HP.COM
 (Shankar Unni) writes:
>Both INCLUDE's and IF/IFDEF's are ESSENTIAL for any program that must be 
>targeted at widely different machines. Now don't get me wrong: I'm not 
>saying that it is impossible to do so (I've heard all the arguments about
>"isolating system-dependent code in modules of their own and re-writing
>them for different systems"), but still, for convenience and efficiency,
>there is no beating conditional compilation.

  I agree that include files are nice.  However, they shouldn't be
necessary if modules are correctly supported (well, correctly in my
opinion :-).  Check out the VAX Pascal [ENVIRONMENT] and [INHERIT]
mechanism for a good example of this.  (Besides getting rid of nasty
source-changing pragmas, they save the compiler from doing all the
work of parsing etc. twice.)
  I'm not sure that IF/IFDEF is necessary at a source level.  What's
wrong with just using something like:

	const doing_ansi = false;

	...

	if doing_ansi then
	  begin
	    { do ansi stuff }
	  end;

  (Of course, you could pick some convention for distinguishing these
constants from ordinary variables: capital letters, for instance.)
I've used this in a number of my programs; any modern compilers should
eliminate the dead code.  (All the ones I use do.)

		Anton

+---------------------------+------------------------+----------------------+
| Anton Rang (grad student) | "VMS Forever!"         | "Do worry...be SAD!" |
| Michigan State University | rang@cpswh.cps.msu.edu |                      |
+---------------------------+------------------------+----------------------+