david@starsoft.hou.tx.us (Dave Lowrey) (06/13/91)
I was having some problems getting some code to properly compile. I have
isolated the problem to some code involving '#elif' preprocessor
statements.
The following sample code illustrates the problem:
=========================================================
#include <stdio.h>
#define TEST2 1
main()
{
int i,j,k;
i=j=k=1;
#ifdef TEST1
i=2;
#elif TEST2
j=2;
#else
k=2;
#endif
printf("%d %d %d\n", i, j, k);
}
====================================================
Now, I feel that the output should read: 1 2 1
However, SAS/C produces: 1 1 2
My UNIX system at work produces the correct answer (1 2 1).
Is this a known SAS/C bug?
I am running 5.10a
Dave Lowrey
----------------------------------------------------------------------------
These words be mine. The company doesn't care, because I am the company! :-)
Dave Lowrey | david@starsoft.hou.tx.us
Starbound Software Group | "The large print giveth, the small print
Houston, TX | taketh away." -- Tom Waits in "Step Right Up"
----------------------------------------------------------------------------
These words be mine. The company doesn't care, because I am the company! :-)
Dave Lowrey | david@starsoft.hou.tx.us
Starbound Software Group | "The large print giveth, the small print
Houston, TX | taketh away." -- Tom Waits in "Step Right Up"
david@starsoft.hou.tx.us (Dave Lowrey) (06/15/91)
In regards to my posting about a bug with SAS/C..... I received the following message from someone at SAS: ======================================================================== Hi, Someone forwarded the following to me. It is definitely a bug in our compiler. I have reported it. The workaround is to use #if instead of #ifdef. Let me know if I can be of further help. Our phone number is (919)677-8009. Please have your registration number ready. Khristi Tomlinson SAS/C Tech Support > In article <david.1187@starsoft.hou.tx.us>, david@starsoft.hou.tx.us (Dave > Lowrey) writes: > |> I was having some problems getting some code to properly compile. I have > |> isolated the problem to some code involving '#elif' preprocessor > |> statements. > |> > |> The following sample code illustrates the problem: > |> > |> ========================================================= > |> #include <stdio.h> > |> > |> #define TEST2 1 > |> > |> main() > |> { > |> int i,j,k; > |> > |> i=j=k=1; > |> > |> #ifdef TEST1 > |> i=2; > |> #elif TEST2 > |> j=2; > |> #else > |> k=2; > |> #endif > |> > |> printf("%d %d %d\n", i, j, k); > |> } > |> ==================================================== > |> > |> Now, I feel that the output should read: 1 2 1 > |> > |> However, SAS/C produces: 1 1 2 > |> > |> My UNIX system at work produces the correct answer (1 2 1). > |> > |> Is this a known SAS/C bug? > |> > |> I am running 5.10a > |> > |> Dave Lowrey > |> --------------------------------------------------------------------------- - =========================================================================== ---------------------------------------------------------------------------- These words be mine. The company doesn't care, because I am the company! :-) Dave Lowrey | david@starsoft.hou.tx.us Starbound Software Group | "The large print giveth, the small print Houston, TX | taketh away." -- Tom Waits in "Step Right Up"
plav@cup.portal.com (Rick M Plavnicky) (06/16/91)
david@starsoft.hou.tx.us (Dave Lowrey) writes: >I was having some problems getting some code to properly compile. I have >isolated the problem to some code involving '#elif' preprocessor >statements. > >The following sample code illustrates the problem: [sample code omitted] >Now, I feel that the output should read: 1 2 1 > >However, SAS/C produces: 1 1 2 > >My UNIX system at work produces the correct answer (1 2 1). > >Is this a known SAS/C bug? > >I am running 5.10a For what it's worth, Manx 5.0d produces the expected output of (1 2 1). > Dave Lowrey | david@starsoft.hou.tx.us /* Rick Plavnicky ...!sun!cup.portal.com!plav -or- plav@cup.portal.com */