ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1992/09/12/04:41:19

To: George Jetson <pynq AT midway DOT uchicago DOT edu>
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: Statement expressions?
Date: Sat, 12 Sep 92 14:24:04 +0900
From: kawahara AT mtc DOT telcom DOT oki DOT co DOT jp

>> main()
>> {
>>         int i = 5;
>> 
>>         i = { if (i < 3) i = 19; 9; } ;
>>         printf("i = %d\n",i);
>> }
>> 
>> However, it does not compile under DJGPP 1.08
>> 
>> (The result, BTW, should be that i == 9 regardless of the original value)
>> 
>> Am I missing something?

I think correct style is following.

main()
{
        int i = 5;

        i = ({ if (i < 3) 19; 9; }) ;
        printf("i = %d\n",i);
}

It have to need '( )' avoiding statement/expression confusion.
--
Kawahara Taro

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019