[comp.sys.amiga.programmer] SAS C5.10a BUG?

rob@spirits.ka.sub.org (Roland Bless) (04/12/91)

Hi!

I've trouble with SAS C 5.10a.
Consider the following program:
------------------------- cut here -------------------------
#include <stdio.h>
#include <math.h>

void main(void);

int n;
double db;

void
main(void)
{
  printf("Gimme a double:");
  scanf("%lf",&db);
  printf("Gimme a number:");
  scanf("%d",&n);
  printf("got: %d\n",n);
}
------------------------- cut here -------------------------
When compiling with:
lc -w -fi test
and linking with
BLINK LIB:c.o,test.o LIB LIB:lcmieee.lib LIB:lcs.lib

The program will read the first value, but it won't wait at the second
scanf, it returns 0 in n instead!!
----
Gimme a double:42
Gimme a number:got: 0
----
What's this?

BTW: The problem doesn't show up, if compiled as follows:
lc -fi test
BLINK LIB:c.o,test.o LIB LIB:lcmieee.lib LIB:lc.lib
or
lc -w test
BLINK LIB:c.o,test.o LIB LIB:lcms.lib LIB:lcs.lib

Or is it my fault?
Seems to be the same with lcm881.lib...

Any suggestions? (Yes, I want to use 16-bit ints and IEEE for some reasons)

 Roland

--
R o l a n d   B l e s s |UUCP/USENET: rob@spirits.ka.sub.org                |
Kriegsstrasse 129       |BITNET: UKG5@DKAUNI2.BITNET      FAX: +49211623818 |
7500 Karlsruhe - FRG    |---------spirits--in--the--material--world---------|
voice +49 721 857328    |"They built machines that they can't control" STING|