[comp.lang.misc] Portability Myth

jnixon@andrew.ATL.GE.COM (John F Nixon) (03/23/90)

adrian@mti.mti.com (Adrian McCarthy) writes:
>There is no compatible C compiler for UNIX and VAX/VMS, and there can't be
>because there are too many fundamental differences between these operating
>systems.

A lot of code ports between Unix and VMS.  Sure the OS specific stuff
is different, but this isn't a C problem IMO.  If and when we have an
OS standard the issue can be addressed.

>The most obvious example of this is linkage.  VAX C had to introduce two
>keywords "globaldef" and "globalref" to supplement "extern" in order to make
>linkage work as C dictates.

I don't see this.  I have no trouble using extern on VMS.
Could you elaborate?

>Another obvious example is the different
>syntax for filenames, which affects not only how include files are designated,
>but also requires the programmer to #ifdef his code to build the right syntax
>for run-time data files.  

Not true.  VMS C runtime accepts filenames in the form /a/b/c/e instead of
a:[b.c]e.  One does have to think a little bit about include files, but
almost every one is found using #include <filename>.  Heck, you can
even augment the search path, much like the -I option on Unix C compilers.

>I'd also venture a guess that signals require some basic differences.

This is a problem only because DEC doesn't take time to do it
correctly.  Last time I looked, signals were useless since a process
died when a signal arrived *even if you caught it*.  Sounds like
someone took "kill" too literally!  But you can write your own signal
stuff using mailboxes, so DEC could do it too.

You missed the biggest hole, which is fork/exec.  Since new processes
aren't cheap in VMS, all you get is something similar in flavor to vfork.

>I have yet
>to see a C program written in VMS or UNIX environment that sticks strictly
>to the standard library *and* uses it correctly.

Ahhh, so here is the problem.  You want portability *between OSes*
without any OS specific code.  Can't be done that I know.  Not in Ada,
not in FORTRAN, not in C.  But you can get close, and C at least lets
you put everything in one place using conditional compilation.

----
jnixon@atl.ge.com                    ...steinmetz!atl.decnet!jnxion