Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!brl-adm!brl-smoke!smoke!drears@ardc.arpa From: drears@ardc.arpa (P) Newsgroups: net.unix-wizards Subject: 7 option for cc Message-ID: <1934@brl-smoke.ARPA> Date: Wed, 19-Mar-86 18:00:55 EST Article-I.D.: brl-smok.1934 Posted: Wed Mar 19 18:00:55 1986 Date-Received: Sat, 22-Mar-86 05:38:54 EST Sender: news@brl-smoke.ARPA Lines: 45 I work in a 4.2 BSD environment with brl "enhancements". What this means is we have access to system V commands and libraries but not to system V system calls. On one of the programs I was writing I had the following code: #include . . . . writeda() { FILE *fopen(), *daction; if ((daction = fopen(file,"w"))== NULL){ fprintf(stderr,"ERROR: Could not create %s\n",file); perror(""); } /* Writes out actual file */ fprintf(daction," R & A\n"); . . . fclose(daction); } I compiled (maked) using the the -O flag (cc -O progname), when I ran the program that got to the first fprintf statement I got memory fault - core dump. After extensive checking of the program for bugs I gave up. I then ported it over to s System V machine and it worked with no problems. I then read the manual page on cc and read about the -7 option: -7 Compile using a 4.2BSD environment (a UNIX System V environment is the default.) AFter recompilng with the -O7 flags I got it to run and have had no problems since. The question I have is does the -7 option really do that much? What does it do? Could the error be me or the compiler option. I had never used -7 before. I have had no problems with prior programs. ..Dennis