7 option for cc
P
drears at ardc.arpa
Thu Mar 20 09:00:55 AEST 1986
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 <stdio.h>
.
.
.
.
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
More information about the Comp.unix.wizards
mailing list