[comp.lang.pascal] conditional compilation

mccalpin@loligo.cc.fsu.edu (John McCalpin) (01/13/89)

In article <INFO-M2%89011219330825@UCF1VM> <INFO-M2%UCF1VM.bitnet> writes:
>As was recently observed in the info-pascal mailing list, optimization ->
>conditional compilation.  Consider:
>      CONST
>        OpSys = VMS;
>      IF OpSys = VMS THEN
>        DoVMSStuff
>      ELSE
>        DoOtherOSStuff;
>All but the most inanely STUPID of compilers will completely eliminate the
>unreachable code. Anthony L Kimball : alk @ ux.acss.umn.edu / UMNACVX.bitnet

This is only true if the code in Do_VMS_Stuff is *syntactically valid*
on all machines.
Certainly not all machine-specific extensions are compilable on all
systems -- I am thinking of VMS in particular here.  In the Fortran
context, there ain't no way to make most machines compile statements
like
	call LIB$SYS_VMS_SPECIFIC_STUFF (args)
and the optimizers I know of won't remove the dead code unless they
can figure out what it is, since optimization comes long after parsing
and lexical analysis....

In the modula-2 context, I am sure that the machine-specific vector
extensions to the CDC Pascal/Modula-2 compiler (for the Cyber 205 & ETA-10)
are not syntactically valid on other machines....
-- 
----------------------   John D. McCalpin   ------------------------
Dept of Oceanography & Supercomputer Computations Research Institute
mccalpin@masig1.ocean.fsu.edu		mccalpin@nu.cs.fsu.edu
------------------------------------------------------------------