Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!sun-barr!newstop!sun!amdcad!amdahl!starsoft!david From: david@starsoft.hou.tx.us (Dave Lowrey) Newsgroups: comp.sys.amiga.programmer Subject: Re: Sas/C #elif bug Message-ID: Date: 15 Jun 91 15:56:32 GMT Organization: Starbound Software Group Lines: 70 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@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 > |> > |> #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"