[comp.sys.mac.apps] THINK C: Prog Work w/ANSI But Not ANSI881

ezab066@emx.utexas.edu (Albert Wu) (09/28/90)

I used an SE/30 and tried running the following program with THINK C
4.02.  It worked fine if I linked ANSI but the numbers were not even
read correctly if I linked ANSI881.  The program comes from page 2 of
Narain Gehani's C: An Advanced Introduction.

/* Two dollar calculator */

#include <stdio.h>
#include <stdlib.h>
#define PR putchar(':')

main(void)
{
        float a, b;
        char opr;
        float result;

        while (PR, scanf("%f%c%f", &a, &opr, &b) != EOF ){
                printf ("a=%g; opr=%c; b=%g\n\n", a, opr, b);
               switch (opr) {
                        case '+': result = a + b; break;
                        case '-': result = a - b; break;
                        case '*': result = a * b; break;
                        case '/': result = a / b; break;
                        default:
                                printf ("Error: bad operator\n");
                                exit (EXIT_FAILURE);
                        }
                        printf ("*** %g%c%g = %g\n", a, opr, b, result);
                }
                exit (EXIT_SUCCESS);
}

RMG3@psuvm.psu.edu (09/28/90)

  When I was attempting to use Think C 4.00 I ran in to the same problem
as Mr. Wu.  My program would run correctly under the ANSI library, but
not the ANSI881 library.  My program was rather shorter (even) than his.

 #include <stdio.h>
 main()
 {
         float a;
         a = 0.5;
         printf(" %f",a);
 }

  The program runs fine with the ANSI library, and barfs with the ANSI881
library.  I placed a call to Symantec some time ago (a couple months)
at their NOT-toll free number and left the specifics with them.  They
said they would get back to me shortly.  I have never heard from them.
Fortunately, I don't use C for my professional work.

  Bob Grumbine a.k.a. rmg3@psuvm.psu.edu

wbridgm@hubcap.clemson.edu (william t bridgman) (09/29/90)

In article <90271.104436RMG3@psuvm.psu.edu>, RMG3@psuvm.psu.edu writes:
>   When I was attempting to use Think C 4.00 I ran in to the same problem
> as Mr. Wu.  My program would run correctly under the ANSI library, but
> not the ANSI881 library.  My program was rather shorter (even) than his.
> 
[  ... short program deleted ...]
> 
>   The program runs fine with the ANSI library, and barfs with the ANSI881
> library. [deleted stuff] 
> 
>   Bob Grumbine a.k.a. rmg3@psuvm.psu.edu

I don't see anything indicating you set the 68881 flag under compiler
options....  It also has a flag indicating whether you are using the 68000
or 68020.  I think it may be under the EDIT menu.
-----------------------------------------------------------------------
|  William T. "Tom" Bridgman         | wbridgm@hubcap.clemson.edu     |
|  Department of Physics & Astronomy |                                |
|  Clemson University                |"Black Holes under Construction.|
|  Clemson, SC   29634               |       WATCH YOUR STEP!"        |
-----------------------------------------------------------------------