[comp.sys.amiga.programmer] YASG

gerber@sirius.astro.uiuc.edu (Richard Gerber) (04/09/91)

I'm not an expert C programmer, but is this my mistake, or a problem
with SAS/C 5.10a?

Here's the relevant code:

#define ISOTHERMAL 0
...
if(ISOTHERMAL)
{
	code A;
}
else
{
	code B;
}
...

In a program with 11 modules (I mean separate functions in different
files, if this is not the proper lingo), code A gets executed no matter
what value ISOTHERMAL takes. I even replaced 
if(ISOTHERMAL)
with
if(0)
and
if(1)

and it made no difference. code A was always executed. I even watched
it do it with cpr.

After mulling this over for a while, I switched to the "large data
module" option when compiling. Lo and behold the code then worked
properly.
Now I am perfectly ready to admit that I may have been at fault with
compiler settings. But even if I was, there should at least be some sort
of warning. This would be a major mistake with the code; the output from
the entire program would be worthless. It's only because I'm writing this
so as to be portable that I found the problem. When I ran the code on
a Sun 4, there was some error being produced in "code B". It was only when
I ran cpr to try to figure out what was going on that I found this
error with SAS/C.

I'm going to give SAS a call about this unless someone points out to me
that I have turned off a switch that would have produced a warning (or
some such thing).

Regards,
Richard
gerber@rigel.astro.uiuc.edu