Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #123497

Re: "The long goodbye to C" by Eric Raymond

From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c
Subject Re: "The long goodbye to C" by Eric Raymond
Date 2017-11-26 08:46 +1300
Message-ID <f7tvl3F1omrU15@mid.individual.net> (permalink)
References (19 earlier) <vrXPB.15474$Yq.8171@fx44.am4> <ousfs3$snk$1@dont-email.me> <1MjQB.110400$GS.21955@fx06.am4> <ovc6ob$4kr$1@reader2.panix.com> <hChSB.57907$U41.3798@fx07.am4>

Show all headers | View raw


On 11/26/2017 06:19 AM, bartc wrote:
> On 25/11/2017 16:46, ruben safir wrote:
>> On 11/19/2017 01:07 PM, bartc wrote:
>>> It's fairly obvious really
>>
>>
>> No it is not obvious.  I hate languages that have blocks without braces.
> 
> You mean, like C?
> 
> C doesn't need braces around a statement sequence when there are less
> than two statements. Or sometimes, you can have N statement-expressions
> which are separated with commas, again not needing braces.
> 
> And this is when the chance of errors comes in; see the examples in my
> post. Perhaps it will become more obvious.

int main( int argc, char** argv )
{
   int x, y, z;

   if (argc >1)
     x = 100;
   else
     y = 200;
     z = 300;
}

gcc -std=c99 -Wall x.c
x.c: In function ‘main’:
x.c:10:3: warning: this ‘else’ clause does not guard... 
[-Wmisleading-indentation]
    else
    ^~~~
x.c:12:5: note: ...this statement, but the latter is misleadingly 
indented as if it is guarded by the ‘else’
      z = 300;

Use the tools bartc....

-- 
Ian.

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Re: "The long goodbye to C" by Eric Raymond bartc <bc@freeuk.com> - 2017-11-19 18:07 +0000
  Re: "The long goodbye to C" by Eric Raymond David Kleinecke <dkleinecke@gmail.com> - 2017-11-19 10:38 -0800
  Re: "The long goodbye to C" by Eric Raymond David Brown <david.brown@hesbynett.no> - 2017-11-19 22:30 +0100
    Re: "The long goodbye to C" by Eric Raymond Öö Tiib <ootiib@hot.ee> - 2017-11-19 14:22 -0800
  Re: "The long goodbye to C" by Eric Raymond ruben safir <ruben@mrbrklyn.com> - 2017-11-25 11:46 -0500
    Re: "The long goodbye to C" by Eric Raymond bartc <bc@freeuk.com> - 2017-11-25 17:19 +0000
      Re: "The long goodbye to C" by Eric Raymond Ian Collins <ian-news@hotmail.com> - 2017-11-26 08:46 +1300
        Re: "The long goodbye to C" by Eric Raymond bartc <bc@freeuk.com> - 2017-11-25 20:59 +0000
          Re: "The long goodbye to C" by Eric Raymond Ian Collins <ian-news@hotmail.com> - 2017-11-26 11:54 +1300
            Re: "The long goodbye to C" by Eric Raymond bartc <bc@freeuk.com> - 2017-11-25 23:34 +0000
              Re: "The long goodbye to C" by Eric Raymond Ian Collins <ian-news@hotmail.com> - 2017-11-26 14:19 +1300
                Re: "The long goodbye to C" by Eric Raymond bartc <bc@freeuk.com> - 2017-11-26 11:39 +0000
                Re: "The long goodbye to C" by Eric Raymond David Brown <david.brown@hesbynett.no> - 2017-11-26 13:20 +0100
                Re: "The long goodbye to C" by Eric Raymond bartc <bc@freeuk.com> - 2017-11-26 13:43 +0000
                Re: "The long goodbye to C" by Eric Raymond David Brown <david.brown@hesbynett.no> - 2017-11-26 17:32 +0100
                Re: "The long goodbye to C" by Eric Raymond bartc <bc@freeuk.com> - 2017-11-26 17:31 +0000
                Re: "The long goodbye to C" by Eric Raymond David Brown <david.brown@hesbynett.no> - 2017-11-26 22:11 +0100
        Re: "The long goodbye to C" by Eric Raymond Gareth Owen <gwowen@gmail.com> - 2017-11-26 06:53 +0000

csiph-web