C VS Fortran on UNIX

C VS Fortran on UNIX

Post by chris.. » Mon, 21 Dec 1992 00:18:45



Hello there,

        I am going to write a program for number crunching on UNIX. I am
considering between Fortan and C and I am wondering which one would be faster or
what factors would affect the speed of the program.

        I would appreciate any advise.

Thanks,
Chris.

 
 
 

1. DOS vs. Windows vs. Mac vs. Unix vs. NS

The C standard dictates that SEEK_SET, SEEK_CUR and SEEK_END (among others)  
must be #defined in stdio.h.  This is not a POSIX requirement.  The only  
POSIX constraints on stdio.h are that it must #define L_ctermid and  
STREAM_MAX and declare fdopen() and fileno() if _POSIX_SOURCE is #defined.  
It may optionally #define L_cuserid if _POSIX_SOURCE is #defined.

POSIX 1003.1 _does_ however, require that unistd.h #define SEEK_SET &c if  
_POSIX_SOURCE is #defined.  Thus, if you desire POSIX conformance, #include  
unistd.h.

Are you sure about the SunOS headers?  Here's a test I ran on my SPARC at  
work:

% fgrep SEEK_SET /usr/include/unistd.h
#ifndef SEEK_SET
#define SEEK_SET        0       /* Set file pointer to "offset" */
% uname -a
SunOS epimbe 4.1.1 1 sun4c

Perhaps they've moved unistd.h to /usr/5include since 4.1.1??

I do agree on this, and am rapidly tiring of system dependencies being  
handled by #ifdefs.

I've found the "POSIX Programmer's Guide" (Donald Lewine, O'Reilly, ISBN  
0-937175-73-0) to be priceless.  I strongly recommend this book to anyone  
using C, whether they be UNIX programmers or not (but particularly if they  
are).  It not only helps understand "what is defined where and by which  
standard", but also helps programmers to "Do the Right Thing" by clarifying  
what is POSIX conformant and what is historical baggage.

--
-----------------------------------------------------------------------------
Jim Vlcek                         UNIX for $166!
uunet!molly!vlcek                 Novell UnixWare from Information Foundation

2. Gnome version in YDL 2.1

3. C VS Fortran on UNIX

4. Perl CGI script hangs ... sometimes

5. Linux vs OS2 vs NT vs Win95 vs Multics vs PDP11 vs BSD geeks

6. how to measure hit ratio in the data cache?

7. Communications - Unix to Unix vs Unix to DOS

8. load balancing / sharing internet connection query

9. Fortran and C Compiler for Linux (Ex Apollo Domain Fortran)

10. EDC Fortran or MicroWay NDP Fortran run on Linux?

11. Fortran Debugging trouble + comercial Fortran

12. Fortran compiler with VAX Fortran extensions?

13. MATRIX: OS2 vs UNIX vs NT