From: mike@bedrock.sdd.comsat.com (Mike Stennett)
Subject: HELP: cc compiler problem with float
Date: 2 Sep 1993 14:01:03 -0400 [thread overview]
Message-ID: <mike.746991499@sdd.comsat.com> (raw)
Dear Helpful Netters:
I'm currently having a problem with the DEC cc compiler an passing floats.
What I would like to do is define a function in K&R style but in a header
file give it a full function prototye with parameters. (The reason is
I would like to integrate a K&R style library with some C++ code.) The
following program demonstrates the problem I'm having. It is done completely
with cc (no C++). The problem is that the K&R definition expects a float
of size 8 instead of size 4. The man page would indicate that this is
because DEC cc "promote[s] expressions of type float to type double". However,
the "-f" flag which is suppose to stop the "promotion" doesn't seem to work.
Therefore I will guess I have a bad version of cc and need to upgrade to a
more recent version.
1) Can anyone tell me if I am right or else what is wrong and how to fix it?
2) If I'm right, can you tell me what version of cc I need?
Thank you for your time and help. Please E-mail. I'll post results if
requested to.
Here is the example:
CONTENTS:
1) test3.c /* test source file 1 */
2) test4.c /* test source file 2 */
3) Makefile /* has some extra stuff for C++ which you should ignore */
4) Output from build /* including cc version */
5) Program Results
/**** BEGIN test3.c */
#include <stdio.h>
float printfloat1(x)
float x;
{
float y;
fprintf(stderr, "help %d\n", sizeof(y));
fprintf(stderr, "help %d\n", sizeof(x));
return x;
}
float printfloat2(x)
float x;
{
float y;
fprintf(stderr, "help %d\n", sizeof(y));
fprintf(stderr, "help %d\n", sizeof(x));
return x;
}
float printfloat3(float x)
{
float y;
fprintf(stderr, "help %d\n", sizeof(y));
fprintf(stderr, "help %d\n", sizeof(x));
return x;
}
float printfloat4(float x)
{
float y;
fprintf(stderr, "help %d\n", sizeof(y));
fprintf(stderr, "help %d\n", sizeof(x));
return x;
}
/****** END test3.c */
/******* BEGIN test4.c */
#include <stdio.h>
extern float printfloat1(float x);
extern float printfloat2();
extern float printfloat3(float x);
extern float printfloat4();
main()
{
float y;
float z;
y = 99.1;
z = printfloat1(y);
fprintf(stderr, "%f\n", z);
z = printfloat2(y);
fprintf(stderr, "%f\n", z);
z = printfloat3(y);
fprintf(stderr, "%f\n", z);
z = printfloat4(y);
fprintf(stderr, "%f\n", z);
}
/********* END test4.c */
/******** BEGIN Makefile */
.SUFFIXES: .o .C
# DECs C++ compiler
CXXFLAGS = -DXTFUNCPROTO -DFUNCPROTO -DRW_COMPILE_INSTANTIATE -DRWNO_STD_TYPEDEFS
CXX = cxx
.C.o:
$(CXX) -g -I.. -I$(HOME)/axis/devl/include/Xa $(CXXFLAGS) -c $*.C
.c.o:
$(CXX) -g -I.. -I$(HOME)/axis/devl/include/Xa $(CXXFLAGS) -c $*.c
all:: test
test3.o:test3.c
cc -V -f -c $*.c
test4.o:test4.c
cc -V -f -c $*.c
test4:test4.o test3.o
cc -f -o test4 test4.o test3.o
test:test.o test3.o
$(CXX) -p $(CXXFLAGS) -o test test.o test3.o
testt:testtemplate.o
$(CXX) -g $(CXXFLAGS) -o testt testtemplate.o
/******** END Makefile */
/******** BEGIN Output from build */
cc -V -f -c test4.c
/usr/lib/cmplrs/cc/cpp:
yaccpar 4.1 (Berkeley) 2/11/83
data.c 6.1 (ULTRIX) 11/19/91
fopen.c 6.1 ULTRIX 11/19/91
fclose.c 6.1 (ULTRIX) 11/19/91
fprintf.c 6.1 (ULTRIX) 11/19/91
sprintf.c 6.1 (ULTRIX) 11/19/91
malloc.c 6.2 (ULTRIX) 6/8/92
flsbuf.c 6.1 (ULTRIX) 11/19/91
strlen.c 6.1 (ULTRIX) 11/19/91
calloc.c 6.1 (ULTRIX) 11/19/91
errlst.c 6.1 ULTRIX 11/19/91
doopen.c 6.1 ULTRIX 11/19/91
findiop.c 6.1 ULTRIX 11/19/91
doprnt.c 6.1 (ULTRIX) 11/19/91
getstdiobuf.c 6.1 (ULTRIX) 11/19/91
ctype.c 6.1 ULTRIX 11/19/91
_locale.c 6.1 ULTRIX 11/19/91
/usr/lib/cmplrs/cc/ccom:
yaccpar 4.1 (Berkeley) 2/11/83
sprintf.c 6.1 (ULTRIX) 11/19/91
data.c 6.1 (ULTRIX) 11/19/91
freopen.c 6.1 ULTRIX 11/19/91
fprintf.c 6.1 (ULTRIX) 11/19/91
printf.c 6.1 (ULTRIX) 11/19/91
signal.c 6.1 ULTRIX 11/19/91
ctype.c 6.1 ULTRIX 11/19/91
malloc.c 6.2 (ULTRIX) 6/8/92
strlen.c 6.1 (ULTRIX) 11/19/91
strncpy.c 6.1 (ULTRIX) 11/19/91
calloc.c 6.1 (ULTRIX) 11/19/91
fputs.c 6.1 (ULTRIX) 11/19/91
atof.c 6.1 (ULTRIX) 11/19/91
flsbuf.c 6.1 (ULTRIX) 11/19/91
strncmp.c 6.1 (ULTRIX) 11/19/91
fseek.c 6.1 (ULTRIX) 11/19/91
ftell.c 6.1 (ULTRIX) 11/19/91
fread.c 6.1 (ULTRIX) 11/19/91
fwrite.c 6.1 (ULTRIX) 11/19/91
doprnt.c 6.1 (ULTRIX) 11/19/91
fclose.c 6.1 (ULTRIX) 11/19/91
doopen.c 6.1 ULTRIX 11/19/91
filbuf.c 6.1 ULTRIX 11/19/91
fdopen.c 6.1 ULTRIX 11/19/91
_locale.c 6.1 ULTRIX 11/19/91
getstdiobuf.c 6.1 (ULTRIX) 11/19/91
findiop.c 6.1 ULTRIX 11/19/91
/usr/lib/cmplrs/cc/ujoin:
data.c 6.1 (ULTRIX) 11/19/91
fprintf.c 6.1 (ULTRIX) 11/19/91
time.c 6.1 (ULTRIX) 11/19/91
fclose.c 6.1 (ULTRIX) 11/19/91
errlst.c 6.1 ULTRIX 11/19/91
strlen.c 6.1 (ULTRIX) 11/19/91
doprnt.c 6.1 (ULTRIX) 11/19/91
calloc.c 6.1 (ULTRIX) 11/19/91
malloc.c 6.2 (ULTRIX) 6/8/92
fdopen.c 6.1 ULTRIX 11/19/91
fseek.c 6.1 (ULTRIX) 11/19/91
fwrite.c 6.1 (ULTRIX) 11/19/91
ctype.c 6.1 ULTRIX 11/19/91
_locale.c 6.1 ULTRIX 11/19/91
flsbuf.c 6.1 (ULTRIX) 11/19/91
findiop.c 6.1 ULTRIX 11/19/91
filbuf.c 6.1 ULTRIX 11/19/91
getstdiobuf.c 6.1 (ULTRIX) 11/19/91
/usr/lib/cmplrs/cc/uld:
ld.c 6.1 ULTRIX 11/19/91
signal.c 6.1 ULTRIX 11/19/91
data.c 6.1 (ULTRIX) 11/19/91
fprintf.c 6.1 (ULTRIX) 11/19/91
printf.c 6.1 (ULTRIX) 11/19/91
fwrite.c 6.1 (ULTRIX) 11/19/91
sprintf.c 6.1 (ULTRIX) 11/19/91
ctype.c 6.1 ULTRIX 11/19/91
malloc.c 6.2 (ULTRIX) 6/8/92
strncmp.c 6.1 (ULTRIX) 11/19/91
strlen.c 6.1 (ULTRIX) 11/19/91
calloc.c 6.1 (ULTRIX) 11/19/91
strncpy.c 6.1 (ULTRIX) 11/19/91
errlst.c 6.1 ULTRIX 11/19/91
fopen.c 6.1 ULTRIX 11/19/91
fclose.c 6.1 (ULTRIX) 11/19/91
time.c 6.1 (ULTRIX) 11/19/91
filbuf.c 6.1 ULTRIX 11/19/91
doprnt.c 6.1 (ULTRIX) 11/19/91
flsbuf.c 6.1 (ULTRIX) 11/19/91
doopen.c 6.1 ULTRIX 11/19/91
findiop.c 6.1 ULTRIX 11/19/91
getstdiobuf.c 6.1 (ULTRIX) 11/19/91
_locale.c 6.1 ULTRIX 11/19/91
/usr/lib/cmplrs/cc/usplit:
data.c 6.1 (ULTRIX) 11/19/91
fprintf.c 6.1 (ULTRIX) 11/19/91
errlst.c 6.1 ULTRIX 11/19/91
strlen.c 6.1 (ULTRIX) 11/19/91
fclose.c 6.1 (ULTRIX) 11/19/91
doprnt.c 6.1 (ULTRIX) 11/19/91
calloc.c 6.1 (ULTRIX) 11/19/91
malloc.c 6.2 (ULTRIX) 6/8/92
fdopen.c 6.1 ULTRIX 11/19/91
fseek.c 6.1 (ULTRIX) 11/19/91
fwrite.c 6.1 (ULTRIX) 11/19/91
ctype.c 6.1 ULTRIX 11/19/91
_locale.c 6.1 ULTRIX 11/19/91
flsbuf.c 6.1 (ULTRIX) 11/19/91
findiop.c 6.1 ULTRIX 11/19/91
filbuf.c 6.1 ULTRIX 11/19/91
getstdiobuf.c 6.1 (ULTRIX) 11/19/91
/usr/lib/cmplrs/cc/umerge:
fclose.c 6.1 (ULTRIX) 11/19/91
malloc.c 6.2 (ULTRIX) 6/8/92
data.c 6.1 (ULTRIX) 11/19/91
fopen.c 6.1 ULTRIX 11/19/91
fprintf.c 6.1 (ULTRIX) 11/19/91
errlst.c 6.1 ULTRIX 11/19/91
doprnt.c 6.1 (ULTRIX) 11/19/91
flsbuf.c 6.1 (ULTRIX) 11/19/91
atof.c 6.1 (ULTRIX) 11/19/91
strlen.c 6.1 (ULTRIX) 11/19/91
sprintf.c 6.1 (ULTRIX) 11/19/91
ecvt.c 6.1 (ULTRIX) 11/19/91
doopen.c 6.1 ULTRIX 11/19/91
findiop.c 6.1 ULTRIX 11/19/91
filbuf.c 6.1 ULTRIX 11/19/91
calloc.c 6.1 (ULTRIX) 11/19/91
ctype.c 6.1 ULTRIX 11/19/91
_locale.c 6.1 ULTRIX 11/19/91
getstdiobuf.c 6.1 (ULTRIX) 11/19/91
fdopen.c 6.1 ULTRIX 11/19/91
fseek.c 6.1 (ULTRIX) 11/19/91
fwrite.c 6.1 (ULTRIX) 11/19/91
/usr/lib/cmplrs/cc/uopt:
fclose.c 6.1 (ULTRIX) 11/19/91
data.c 6.1 (ULTRIX) 11/19/91
fprintf.c 6.1 (ULTRIX) 11/19/91
sprintf.c 6.1 (ULTRIX) 11/19/91
flsbuf.c 6.1 (ULTRIX) 11/19/91
strlen.c 6.1 (ULTRIX) 11/19/91
ecvt.c 6.1 (ULTRIX) 11/19/91
ungetc.c 6.1 (ULTRIX) 11/19/91
filbuf.c 6.1 ULTRIX 11/19/91
fopen.c 6.1 ULTRIX 11/19/91
freopen.c 6.1 ULTRIX 11/19/91
fseek.c 6.1 (ULTRIX) 11/19/91
setbuffer.c 6.1 (ULTRIX) 11/19/91
setlinebuf.c 6.1 (ULTRIX) 11/19/91
malloc.c 6.2 (ULTRIX) 6/8/92
sibuf.c 6.1 (ULTRIX) 11/19/91
errlst.c 6.1 ULTRIX 11/19/91
doprnt.c 6.1 (ULTRIX) 11/19/91
getstdiobuf.c 6.1 (ULTRIX) 11/19/91
doopen.c 6.1 ULTRIX 11/19/91
findiop.c 6.1 ULTRIX 11/19/91
setvbuf.c 6.1 (ULTRIX) 11/19/91
sobuf.c 6.1 (ULTRIX) 11/19/91
ctype.c 6.1 ULTRIX 11/19/91
_locale.c 6.1 ULTRIX 11/19/91
calloc.c 6.1 (ULTRIX) 11/19/91
/usr/lib/cmplrs/cc/ugen:
fclose.c 6.1 (ULTRIX) 11/19/91
malloc.c 6.2 (ULTRIX) 6/8/92
mktemp.c 6.1 (ULTRIX) 11/19/91
data.c 6.1 (ULTRIX) 11/19/91
fopen.c 6.1 ULTRIX 11/19/91
fprintf.c 6.1 (ULTRIX) 11/19/91
fwrite.c 6.1 (ULTRIX) 11/19/91
errlst.c 6.1 ULTRIX 11/19/91
sprintf.c 6.1 (ULTRIX) 11/19/91
flsbuf.c 6.1 (ULTRIX) 11/19/91
strlen.c 6.1 (ULTRIX) 11/19/91
ecvt.c 6.1 (ULTRIX) 11/19/91
ungetc.c 6.1 (ULTRIX) 11/19/91
filbuf.c 6.1 ULTRIX 11/19/91
freopen.c 6.1 ULTRIX 11/19/91
fseek.c 6.1 (ULTRIX) 11/19/91
setbuffer.c 6.1 (ULTRIX) 11/19/91
setlinebuf.c 6.1 (ULTRIX) 11/19/91
sibuf.c 6.1 (ULTRIX) 11/19/91
fdopen.c 6.1 ULTRIX 11/19/91
calloc.c 6.1 (ULTRIX) 11/19/91
doopen.c 6.1 ULTRIX 11/19/91
findiop.c 6.1 ULTRIX 11/19/91
doprnt.c 6.1 (ULTRIX) 11/19/91
getstdiobuf.c 6.1 (ULTRIX) 11/19/91
setvbuf.c 6.1 (ULTRIX) 11/19/91
sobuf.c 6.1 (ULTRIX) 11/19/91
ctype.c 6.1 ULTRIX 11/19/91
_locale.c 6.1 ULTRIX 11/19/91
/usr/lib/cmplrs/cc/as0:
fclose.c 6.1 (ULTRIX) 11/19/91
strlen.c 6.1 (ULTRIX) 11/19/91
malloc.c 6.2 (ULTRIX) 6/8/92
sprintf.c 6.1 (ULTRIX) 11/19/91
data.c 6.1 (ULTRIX) 11/19/91
fprintf.c 6.1 (ULTRIX) 11/19/91
flsbuf.c 6.1 (ULTRIX) 11/19/91
ungetc.c 6.1 (ULTRIX) 11/19/91
filbuf.c 6.1 ULTRIX 11/19/91
fopen.c 6.1 ULTRIX 11/19/91
freopen.c 6.1 ULTRIX 11/19/91
fseek.c 6.1 (ULTRIX) 11/19/91
setbuffer.c 6.1 (ULTRIX) 11/19/91
setlinebuf.c 6.1 (ULTRIX) 11/19/91
sibuf.c 6.1 (ULTRIX) 11/19/91
ecvt.c 6.1 (ULTRIX) 11/19/91
errlst.c 6.1 ULTRIX 11/19/91
fdopen.c 6.1 ULTRIX 11/19/91
fwrite.c 6.1 (ULTRIX) 11/19/91
calloc.c 6.1 (ULTRIX) 11/19/91
doprnt.c 6.1 (ULTRIX) 11/19/91
getstdiobuf.c 6.1 (ULTRIX) 11/19/91
doopen.c 6.1 ULTRIX 11/19/91
findiop.c 6.1 ULTRIX 11/19/91
setvbuf.c 6.1 (ULTRIX) 11/19/91
sobuf.c 6.1 (ULTRIX) 11/19/91
ctype.c 6.1 ULTRIX 11/19/91
_locale.c 6.1 ULTRIX 11/19/91
/usr/lib/cmplrs/cc/as1:
fclose.c 6.1 (ULTRIX) 11/19/91
strlen.c 6.1 (ULTRIX) 11/19/91
atof.c 6.1 (ULTRIX) 11/19/91
time.c 6.1 (ULTRIX) 11/19/91
malloc.c 6.2 (ULTRIX) 6/8/92
data.c 6.1 (ULTRIX) 11/19/91
fprintf.c 6.1 (ULTRIX) 11/19/91
fputs.c 6.1 (ULTRIX) 11/19/91
printf.c 6.1 (ULTRIX) 11/19/91
errlst.c 6.1 ULTRIX 11/19/91
flsbuf.c 6.1 (ULTRIX) 11/19/91
strncpy.c 6.1 (ULTRIX) 11/19/91
sprintf.c 6.1 (ULTRIX) 11/19/91
ungetc.c 6.1 (ULTRIX) 11/19/91
filbuf.c 6.1 ULTRIX 11/19/91
fopen.c 6.1 ULTRIX 11/19/91
freopen.c 6.1 ULTRIX 11/19/91
fseek.c 6.1 (ULTRIX) 11/19/91
setbuffer.c 6.1 (ULTRIX) 11/19/91
setlinebuf.c 6.1 (ULTRIX) 11/19/91
sibuf.c 6.1 (ULTRIX) 11/19/91
ecvt.c 6.1 (ULTRIX) 11/19/91
fdopen.c 6.1 ULTRIX 11/19/91
fwrite.c 6.1 (ULTRIX) 11/19/91
calloc.c 6.1 (ULTRIX) 11/19/91
ctype.c 6.1 ULTRIX 11/19/91
_locale.c 6.1 ULTRIX 11/19/91
doprnt.c 6.1 (ULTRIX) 11/19/91
getstdiobuf.c 6.1 (ULTRIX) 11/19/91
doopen.c 6.1 ULTRIX 11/19/91
findiop.c 6.1 ULTRIX 11/19/91
setvbuf.c 6.1 (ULTRIX) 11/19/91
sobuf.c 6.1 (ULTRIX) 11/19/91
/usr/lib/cmplrs/cc/ld:
ld.c 6.1 ULTRIX 11/19/91
signal.c 6.1 ULTRIX 11/19/91
data.c 6.1 (ULTRIX) 11/19/91
fprintf.c 6.1 (ULTRIX) 11/19/91
printf.c 6.1 (ULTRIX) 11/19/91
fwrite.c 6.1 (ULTRIX) 11/19/91
sprintf.c 6.1 (ULTRIX) 11/19/91
ctype.c 6.1 ULTRIX 11/19/91
malloc.c 6.2 (ULTRIX) 6/8/92
strncmp.c 6.1 (ULTRIX) 11/19/91
strlen.c 6.1 (ULTRIX) 11/19/91
calloc.c 6.1 (ULTRIX) 11/19/91
strncpy.c 6.1 (ULTRIX) 11/19/91
errlst.c 6.1 ULTRIX 11/19/91
fopen.c 6.1 ULTRIX 11/19/91
fclose.c 6.1 (ULTRIX) 11/19/91
time.c 6.1 (ULTRIX) 11/19/91
filbuf.c 6.1 ULTRIX 11/19/91
doprnt.c 6.1 (ULTRIX) 11/19/91
flsbuf.c 6.1 (ULTRIX) 11/19/91
doopen.c 6.1 ULTRIX 11/19/91
findiop.c 6.1 ULTRIX 11/19/91
getstdiobuf.c 6.1 (ULTRIX) 11/19/91
_locale.c 6.1 ULTRIX 11/19/91
/usr/lib/cmplrs/cc/ftoc:
data.c 6.1 (ULTRIX) 11/19/91
fopen.c 6.1 ULTRIX 11/19/91
fclose.c 6.1 (ULTRIX) 11/19/91
fprintf.c 6.1 (ULTRIX) 11/19/91
printf.c 6.1 (ULTRIX) 11/19/91
fread.c 6.1 (ULTRIX) 11/19/91
strlen.c 6.1 (ULTRIX) 11/19/91
malloc.c 6.2 (ULTRIX) 6/8/92
errlst.c 6.1 ULTRIX 11/19/91
doopen.c 6.1 ULTRIX 11/19/91
findiop.c 6.1 ULTRIX 11/19/91
doprnt.c 6.1 (ULTRIX) 11/19/91
filbuf.c 6.1 ULTRIX 11/19/91
calloc.c 6.1 (ULTRIX) 11/19/91
ctype.c 6.1 ULTRIX 11/19/91
_locale.c 6.1 ULTRIX 11/19/91
flsbuf.c 6.1 (ULTRIX) 11/19/91
getstdiobuf.c 6.1 (ULTRIX) 11/19/91
/usr/lib/cmplrs/cc/cord:
data.c 6.1 (ULTRIX) 11/19/91
fopen.c 6.1 ULTRIX 11/19/91
fdopen.c 6.1 ULTRIX 11/19/91
fclose.c 6.1 (ULTRIX) 11/19/91
fprintf.c 6.1 (ULTRIX) 11/19/91
fseek.c 6.1 (ULTRIX) 11/19/91
ftell.c 6.1 (ULTRIX) 11/19/91
fread.c 6.1 (ULTRIX) 11/19/91
fwrite.c 6.1 (ULTRIX) 11/19/91
ldopen.c: 1.3 2/16/83
ldclose.c: 1.3 2/16/83
ldohseek.c: 1.1 1/7/82
malloc.c 6.2 (ULTRIX) 6/8/92
ldshread.c: 1.1 1/7/82
ldsseek.c: 1.1 1/7/82
calloc.c 6.1 (ULTRIX) 11/19/91
ldgetname.c: 1.2 2/16/83
ldtbread.c: 1.1 1/7/82
ldgetname.c: 1.2 2/16/83
strlen.c 6.1 (ULTRIX) 11/19/91
ldrseek.c: 1.1 1/7/82
ldnrseek.c: 1.1 1/7/82
errlst.c 6.1 ULTRIX 11/19/91
doopen.c 6.1 ULTRIX 11/19/91
findiop.c 6.1 ULTRIX 11/19/91
filbuf.c 6.1 ULTRIX 11/19/91
doprnt.c 6.1 (ULTRIX) 11/19/91
flsbuf.c 6.1 (ULTRIX) 11/19/91
scanf.c 6.1 (ULTRIX) 11/19/91
vldldptr.c: 1.1 1/8/82
allocldptr.c: 1.2 2/16/83
freeldptr.c: 1.1 1/7/82
strncmp.c 6.1 (ULTRIX) 11/19/91
rew.c 6.1 (ULTRIX) 11/19/91
ldnshread.c: 1.1 1/7/82
getstdiobuf.c 6.1 (ULTRIX) 11/19/91
ctype.c 6.1 ULTRIX 11/19/91
_locale.c 6.1 ULTRIX 11/19/91
doscan.c 6.1 ULTRIX 11/19/91
ungetc.c 6.1 (ULTRIX) 11/19/91
atof.c 6.1 (ULTRIX) 11/19/91
/usr/lib/cmplrs/cc/crt0.o:
cc (cc)
Mips Computer Systems 2.10
cc -V -f -c test3.c
/**** I delete the second listing of the version to save bandwidth */
cc -f -o test4 test4.o test3.o
/******** END Output from build */
/******** BEGIN Program Output */
help 4
help 8
0.000000
help 4
help 8
99.099998
help 4
help 4
99.099998
help 4
help 4
36893488147419103000.000000
/******** END Program Output */
--
Signed: Mike Stennett Domain: mike@sdd.comsat.com
Phone: +1-301-428-4083 Fax: +1-301-428-7747
USPS: COMSAT Labs, 22300 COMSAT Drive, Clarksburg, MD 20871
reply other threads:[~1993-09-02 18:01 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox