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


Groups > comp.lang.c > #4783 > unrolled thread

C programming in 2011

Started byDuncan Bayne <dhgbayne@gmail.com>
First post2011-05-25 20:27 -0700
Last post2011-05-26 18:02 +0100
Articles 20 on this page of 150 — 40 participants

Back to article view | Back to comp.lang.c


Contents

  C programming in 2011 Duncan Bayne <dhgbayne@gmail.com> - 2011-05-25 20:27 -0700
    Re: C programming in 2011 Shao Miller <sha0.miller@gmail.com> - 2011-05-25 22:33 -0500
    Re: C programming in 2011 Duncan Bayne <dhgbayne@gmail.com> - 2011-05-25 20:58 -0700
      Re: C programming in 2011 Duncan Bayne <dhgbayne@gmail.com> - 2011-05-25 21:06 -0700
        Re: C programming in 2011 Shao Miller <sha0.miller@gmail.com> - 2011-05-25 23:24 -0500
    Re: C programming in 2011 Angel <angel+news@spamcop.net> - 2011-05-26 07:51 +0000
      Re: C programming in 2011 Chris H <chris@phaedsys.org> - 2011-05-26 11:15 +0100
        Re: C programming in 2011 James Kuyper <jameskuyper@verizon.net> - 2011-05-26 06:53 -0400
          Re: C programming in 2011 Ian Collins <ian-news@hotmail.com> - 2011-05-27 09:12 +1200
        Re: C programming in 2011 Nizumzen <chicken@mcnuggets.com> - 2011-05-29 00:39 +0100
          Re: C programming in 2011 Noob <root@127.0.0.1> - 2011-06-01 17:38 +0200
            Re: C programming in 2011 Nizumzen <chicken@mcnuggets.com> - 2011-06-01 22:34 +0100
              Re: C programming in 2011 Angel <angel+news@spamcop.net> - 2011-06-01 21:42 +0000
                Re: C programming in 2011 Nizumzen <chicken@mcnuggets.com> - 2011-06-02 00:33 +0100
      Re: C programming in 2011 Duncan Bayne <dhgbayne@gmail.com> - 2011-05-26 03:41 -0700
        Re: C programming in 2011 Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-05-28 00:46 +0000
      Re: C programming in 2011 Chad <cdalten@gmail.com> - 2011-05-26 14:09 -0700
        Re: C programming in 2011 Keith Thompson <kst-u@mib.org> - 2011-05-26 15:07 -0700
        Re: C programming in 2011 Angel <angel+news@spamcop.net> - 2011-05-27 07:42 +0000
        Re: C programming in 2011 James Kuyper <jameskuyper@verizon.net> - 2011-05-27 07:30 -0400
      Re: C programming in 2011 Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-05-29 01:15 +0300
        Re: C programming in 2011 Angel <angel+news@spamcop.net> - 2011-05-28 22:24 +0000
          Re: C programming in 2011 Keith Thompson <kst-u@mib.org> - 2011-05-28 16:08 -0700
            Re: C programming in 2011 Angel <angel+news@spamcop.net> - 2011-05-28 23:47 +0000
              Re: C programming in 2011 Geoff <geoff@invalid.invalid> - 2011-05-28 16:58 -0700
                Re: C programming in 2011 Keith Thompson <kst-u@mib.org> - 2011-05-28 18:49 -0700
                  Re: C programming in 2011 Pierre Habouzit <madcoder@debian.org> - 2011-05-29 11:13 +0000
                    Re: C programming in 2011 Jorge <jorge@jorgechamorro.com> - 2011-06-04 08:05 -0700
                      Re: C programming in 2011 Angel <angel+news@spamcop.net> - 2011-06-04 16:20 +0000
                  Re: C programming in 2011 Nizumzen <chicken@mcnuggets.com> - 2011-05-29 14:35 +0100
                    Re: C programming in 2011 Keith Thompson <kst-u@mib.org> - 2011-05-29 12:49 -0700
                      OT: Brackets, parentheses, etc. (Was: C programming in 2011) Shao Miller <sha0.miller@gmail.com> - 2011-05-29 16:13 -0500
                        Re: OT: Brackets, parentheses, etc. (Was: C programming in 2011) "Morris Keesan" <mkeesan@post.harvard.edu> - 2011-05-30 12:17 -0400
                          Re: OT: Brackets, parentheses, etc. (Was: C programming in 2011) Shao Miller <sha0.miller@gmail.com> - 2011-05-30 12:52 -0500
                      Re: C programming in 2011 Nizumzen <chicken@mcnuggets.com> - 2011-05-29 23:58 +0100
                        Re: C programming in 2011 Chris H <chris@phaedsys.org> - 2011-05-30 14:42 +0100
                          Re: C programming in 2011 Nizumzen <chicken@mcnuggets.com> - 2011-05-30 17:40 +0100
                          Re: C programming in 2011 Sjouke Burry <burrynulnulfour@ppllaanneett.nnll> - 2011-05-30 22:38 +0200
                      Re: C programming in 2011 "J. J. Farrell" <jjf@bcs.org.uk> - 2011-05-30 00:38 +0100
                      Re: C programming in 2011 Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-05-30 11:14 +0300
                Re: C programming in 2011 Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-05-29 06:55 -0700
              Re: C programming in 2011 Keith Thompson <kst-u@mib.org> - 2011-05-28 18:47 -0700
                Re: C programming in 2011 Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-05-30 15:02 +0300
          Re: C programming in 2011 Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-05-30 11:01 +0300
            Re: C programming in 2011 Angel <angel+news@spamcop.net> - 2011-05-30 08:51 +0000
              Re: C programming in 2011 Nobody <nobody@nowhere.com> - 2011-05-31 01:54 +0100
                Re: C programming in 2011 Angel <angel+news@spamcop.net> - 2011-05-31 12:00 +0000
                  Re: C programming in 2011 Seebs <usenet-nospam@seebs.net> - 2011-05-31 16:44 +0000
                    Re: C programming in 2011 Keith Thompson <kst-u@mib.org> - 2011-05-31 11:43 -0700
    Re: C programming in 2011 Chris H <chris@phaedsys.org> - 2011-05-26 11:13 +0100
    Re: C programming in 2011 Francois Grieu <fgrieu@gmail.com> - 2011-05-26 16:04 +0200
      Re: C programming in 2011 Branimir Maksimovic <bmaxa@hotmail.com> - 2011-05-26 16:21 +0200
        Re: C programming in 2011 Francois Grieu <fgrieu@gmail.com> - 2011-05-26 17:23 +0200
          Re: C programming in 2011 Branimir Maksimovic <bmaxa@hotmail.com> - 2011-05-26 19:15 +0200
            Re: C programming in 2011 Willem <willem@toad.stack.nl> - 2011-05-26 17:29 +0000
              Re: C programming in 2011 Branimir Maksimovic <bmaxa@hotmail.com> - 2011-05-26 20:10 +0200
            Re: C programming in 2011 Pierre Habouzit <madcoder@debian.org> - 2011-05-26 17:35 +0000
              Re: C programming in 2011 Willem <willem@toad.stack.nl> - 2011-05-26 17:53 +0000
                Re: C programming in 2011 Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-05-26 11:13 -0700
                  Re: C programming in 2011 James Kuyper <jameskuyper@verizon.net> - 2011-05-26 21:57 -0400
                    Re: C programming in 2011 Tim Rentsch <txr@alumni.caltech.edu> - 2011-05-31 01:13 -0700
              Re: C programming in 2011 Branimir Maksimovic <bmaxa@hotmail.com> - 2011-05-26 20:06 +0200
            Re: C programming in 2011 Ralf Damaschke <rwspam@gmx.de> - 2011-05-26 17:57 +0000
              Re: C programming in 2011 Keith Thompson <kst-u@mib.org> - 2011-05-26 11:31 -0700
                Re: C programming in 2011 Ralf Damaschke <rwspam@gmx.de> - 2011-05-26 20:43 +0000
                  Re: C programming in 2011 Keith Thompson <kst-u@mib.org> - 2011-05-26 14:53 -0700
          Re: C programming in 2011 Tim Rentsch <txr@alumni.caltech.edu> - 2011-05-31 01:03 -0700
            Re: C programming in 2011 "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-05-31 01:59 -0700
              Re: C programming in 2011 "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-05-31 02:55 -0700
                Re: C programming in 2011 James Kuyper <jameskuyper@verizon.net> - 2011-05-31 06:36 -0400
                  Re: C programming in 2011 "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-05-31 05:57 -0700
                    Re: C programming in 2011 James Kuyper <jameskuyper@verizon.net> - 2011-05-31 09:23 -0400
                      Re: C programming in 2011 "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-05-31 07:50 -0700
                        Re: C programming in 2011 Keith Thompson <kst-u@mib.org> - 2011-05-31 11:41 -0700
                          Re: C programming in 2011 "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-06-01 01:46 -0700
                            Re: C programming in 2011 Ike Naar <ike@iceland.freeshell.org> - 2011-06-01 10:07 +0000
                              Re: C programming in 2011 "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-06-01 04:12 -0700
                                Re: C programming in 2011 "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-06-01 07:46 -0700
                                Re: C programming in 2011 Seebs <usenet-nospam@seebs.net> - 2011-06-01 17:53 +0000
                                Re: C programming in 2011 lawrence.jones@siemens.com - 2011-06-01 16:28 -0400
                                  Re: C programming in 2011 "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-06-01 23:28 -0700
                                  Re: C programming in 2011 Uno <Uno@example.invalid> - 2011-06-09 21:24 -0600
                            Re: C programming in 2011 James Kuyper <jameskuyper@verizon.net> - 2011-06-01 10:04 -0400
                              Re: C programming in 2011 "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-06-01 08:21 -0700
                                Re: C programming in 2011 "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-06-01 09:37 -0700
                                  Re: C programming in 2011 James Kuyper <jameskuyper@verizon.net> - 2011-06-01 12:55 -0400
                                    Re: C programming in 2011 "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-06-01 11:52 -0700
                                      Re: C programming in 2011 "J. J. Farrell" <jjf@bcs.org.uk> - 2011-06-02 00:00 +0100
                                        Re: C programming in 2011 "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-06-01 23:19 -0700
                                Re: C programming in 2011 James Kuyper <jameskuyper@verizon.net> - 2011-06-01 12:53 -0400
                                  Re: C programming in 2011 "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-06-01 11:55 -0700
                              Re: C programming in 2011 Keith Thompson <kst-u@mib.org> - 2011-06-01 08:41 -0700
                            Re: C programming in 2011 Noob <root@127.0.0.1> - 2011-06-01 17:12 +0200
                              Re: C programming in 2011 "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-06-01 09:28 -0700
                            Re: C programming in 2011 Keith Thompson <kst-u@mib.org> - 2011-06-01 08:38 -0700
                              Re: C programming in 2011 "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-06-02 01:00 -0700
                                Re: C programming in 2011 Willem <willem@toad.stack.nl> - 2011-06-02 09:13 +0000
                                  Re: C programming in 2011 "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-06-02 02:52 -0700
                                    Re: C programming in 2011 Willem <willem@toad.stack.nl> - 2011-06-02 11:41 +0000
                                      Re: C programming in 2011 "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-06-02 05:53 -0700
                                        Re: C programming in 2011 "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-06-02 06:49 -0700
                                          Re: C programming in 2011 Willem <willem@toad.stack.nl> - 2011-06-02 14:18 +0000
                                          Re: C programming in 2011 Seebs <usenet-nospam@seebs.net> - 2011-06-02 21:02 +0000
                                            Re: C programming in 2011 "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-06-02 23:55 -0700
                                              Re: C programming in 2011 Angel <angel+news@spamcop.net> - 2011-06-03 08:37 +0000
                                                Re: C programming in 2011 James Kuyper <jameskuyper@verizon.net> - 2011-06-03 06:49 -0400
                                                  Re: C programming in 2011 Angel <angel+news@spamcop.net> - 2011-06-03 11:52 +0000
                                              Re: C programming in 2011 "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-06-03 11:11 -0700
                                                Re: C programming in 2011 Angel <angel+news@spamcop.net> - 2011-06-03 18:23 +0000
                                                  Re: C programming in 2011 Seebs <usenet-nospam@seebs.net> - 2011-06-03 18:59 +0000
                                                    Re: C programming in 2011 Angel <angel+news@spamcop.net> - 2011-06-03 19:48 +0000
                                                      Re: C programming in 2011 "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-06-03 15:02 -0700
                                                Re: C programming in 2011 Keith Thompson <kst-u@mib.org> - 2011-06-03 12:19 -0700
                                                  Re: C programming in 2011 "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-06-03 13:40 -0700
                                                    Re: C programming in 2011 Keith Thompson <kst-u@mib.org> - 2011-06-03 15:11 -0700
                                                      Re: C programming in 2011 "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-06-03 15:24 -0700
                                                        Re: C programming in 2011 Keith Thompson <kst-u@mib.org> - 2011-06-03 15:34 -0700
                                                          Re: C programming in 2011 "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-06-03 17:10 -0700
                                                            Re: C programming in 2011 Keith Thompson <kst-u@mib.org> - 2011-06-03 17:34 -0700
                                                        Re: C programming in 2011 James Kuyper <jameskuyper@verizon.net> - 2011-06-04 09:47 -0400
                                        Re: C programming in 2011 James Kuyper <jameskuyper@verizon.net> - 2011-06-02 10:02 -0400
                                    Re: C programming in 2011 Angel <angel+news@spamcop.net> - 2011-06-02 12:17 +0000
                                Re: C programming in 2011 Keith Thompson <kst-u@mib.org> - 2011-06-02 08:48 -0700
                                  Re: C programming in 2011 "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-06-02 10:35 -0700
                                Re: C programming in 2011 gordonb.jpem8@burditt.org (Gordon Burditt) - 2011-06-05 23:32 -0500
                                  Re: C programming in 2011 "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-06-06 00:12 -0700
                                    Re: C programming in 2011 gordonb.5k8u2@burditt.org (Gordon Burditt) - 2011-06-06 05:18 -0500
                                      Re: C programming in 2011 "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-06-06 08:16 -0700
                            Re: C programming in 2011 Michael Press <rubrum@pacbell.net> - 2011-06-03 18:06 -0700
                            Re: C programming in 2011 gordonb.zourz@burditt.org (Gordon Burditt) - 2011-06-05 21:25 -0500
                              Re: C programming in 2011 "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-06-06 01:14 -0700
                                Re: C programming in 2011 gordonb.donaz@burditt.org (Gordon Burditt) - 2011-06-06 04:36 -0500
                                  Re: C programming in 2011 "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-06-06 09:02 -0700
                                    Re: C programming in 2011 gordonb.k6ruq@burditt.org (Gordon Burditt) - 2011-06-06 18:36 -0500
                                      Re: C programming in 2011 "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-06-07 10:14 -0700
                        Re: C programming in 2011 "J. J. Farrell" <jjf@bcs.org.uk> - 2011-05-31 19:56 +0100
                          Re: C programming in 2011 Noob <root@127.0.0.1> - 2011-06-01 14:54 +0200
                            Re: C programming in 2011 Angel <angel+news@spamcop.net> - 2011-06-01 13:07 +0000
                            Re: C programming in 2011 pete <pfiland@mindspring.com> - 2011-06-01 14:10 -0400
                              Re: C programming in 2011 James Kuyper <jameskuyper@verizon.net> - 2011-06-01 19:58 -0400
                        Re: C programming in 2011 Willem <willem@toad.stack.nl> - 2011-06-01 09:07 +0000
                        Re: C programming in 2011 James Kuyper <jameskuyper@verizon.net> - 2011-06-01 09:29 -0400
                        Re: C programming in 2011 David Thompson <dave.thompson2@verizon.net> - 2011-06-07 02:18 -0400
                          Re: C programming in 2011 "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-06-07 09:31 -0700
                            Re: C programming in 2011 Patrick Scheible <kkt@zipcon.net> - 2011-06-09 14:55 -0700
                Re: C programming in 2011 Tim Rentsch <txr@alumni.caltech.edu> - 2011-06-01 02:35 -0700
            Re: C programming in 2011 Francois Grieu <fgrieu@gmail.com> - 2011-05-31 21:57 +0200
              Re: C programming in 2011 Francois Grieu <fgrieu@gmail.com> - 2011-05-31 22:03 +0200
    Re: C programming in 2011 Kenneth Brody <kenbrody@spamcop.net> - 2011-05-26 12:27 -0400
    Re: C programming in 2011 Nobody <nobody@nowhere.com> - 2011-05-26 18:02 +0100

Page 3 of 8 — ← Prev page 1 2 [3] 4 5 6 7 8  Next page →


#5008

FromMalcolm McLean <malcolm.mclean5@btinternet.com>
Date2011-05-29 06:55 -0700
Message-ID<b5323149-6ede-4288-9a38-8581ce6b1286@m10g2000yqd.googlegroups.com>
In reply to#4965
On May 29, 2:58 am, Geoff <ge...@invalid.invalid> wrote:
>
> I thoroughly detest the words curly braces to describe braces.
>
Think of it as a belt and braces description.
--
MiniBasic - how to write a script interpreter
http://www.lulu.com/bgy1mm

[toc] | [prev] | [next] | [standalone]


#4970

FromKeith Thompson <kst-u@mib.org>
Date2011-05-28 18:47 -0700
Message-ID<lnd3j2s2fs.fsf@nuthaus.mib.org>
In reply to#4963
Angel <angel+news@spamcop.net> writes:
> On 2011-05-28, Keith Thompson <kst-u@mib.org> wrote:
>> Angel <angel+news@spamcop.net> writes:
>> [...]
>>> Coding style is quite a personal thing, and I don't think there is a
>>> real right or wrong in that. It was just something I came across while
>>> browsing through the kernel documentation.
>>>
>>> I like putting my accolades on separate lines so I can clearly see
>>> where blocks begin and end, but others like to put their opening
>>> accolade at the end of the if/while/for/function. Like I said earlier,
>>> whatever works for you. :-)
>>
>> Are you sure that "accolade" is the word you're looking for?
>
> Like I pointed out in another thread, it is the correct word in Dutch.
> I'm not a native English speaker.
>
> It does have that meaning in English too, but only in the context of
> sheet music, it seems. I think "curly brace" is the correct term, no?
>
> Anyway, I mean these things: {}

Understood.

I just checked on dictionary.com, and one of its sources shows "a rare
word for brace" as one of the lesser meanings.  I had never heard of
that usage.  (And I'm reasonably familiar with sheet music.)

Interesting stuff (though not quite topical).  And your English is
certainly much better than my anything-other-than-English!

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Nokia
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

[toc] | [prev] | [next] | [standalone]


#5042

FromPhil Carmody <thefatphil_demunged@yahoo.co.uk>
Date2011-05-30 15:02 +0300
Message-ID<87wrh8qtvh.fsf@bazspaz.fatphil.org>
In reply to#4970
Keith Thompson <kst-u@mib.org> writes:
> Angel <angel+news@spamcop.net> writes:
> > On 2011-05-28, Keith Thompson <kst-u@mib.org> wrote:
> >> Angel <angel+news@spamcop.net> writes:
> >> [...]
> >>> Coding style is quite a personal thing, and I don't think there is a
> >>> real right or wrong in that. It was just something I came across while
> >>> browsing through the kernel documentation.
> >>>
> >>> I like putting my accolades on separate lines so I can clearly see
> >>> where blocks begin and end, but others like to put their opening
> >>> accolade at the end of the if/while/for/function. Like I said earlier,
> >>> whatever works for you. :-)
> >>
> >> Are you sure that "accolade" is the word you're looking for?
> >
> > Like I pointed out in another thread, it is the correct word in Dutch.
> > I'm not a native English speaker.
> >
> > It does have that meaning in English too, but only in the context of
> > sheet music, it seems. I think "curly brace" is the correct term, no?
> >
> > Anyway, I mean these things: {}
> 
> Understood.
> 
> I just checked on dictionary.com, and one of its sources shows "a rare
> word for brace" as one of the lesser meanings.

http://dictionary.reference.com/browse/accolade is enlightening (if you like
etymologies and historical meanings):

1. any award, honor, or laudatory notice: The play received accolades from the press.
2. a light touch on the shoulder with the flat side of the sword or formerly by an embrace, done in the ceremony of conferring knighthood.
3. the ceremony itself.
4. Music. a brace joining several staves.
5. Architecture.
a. an archivolt or hood molding having more or less the form of an ogee arch.
b. a decoration having more or less the form of an ogee arch, cut into a lintel or flat arch.

Origin:
1615-25; < French, derivative of a(c)col\'ee embrace (with -ade [-ade#1]), noun use of feminine past participle of a(c)coler, Old French verbal derivative of col neck (see collar) with a- [a-#5]

So it all makes perfect sense if you can join a few dots.

> I had never heard of
> that usage.  (And I'm reasonably familiar with sheet music.)
> 
> Interesting stuff (though not quite topical).  And your English is
> certainly much better than my anything-other-than-English!

Ditto.

Phil
-- 
"At least you know where you are with Microsoft."
"True. I just wish I'd brought a paddle." -- Matthew Vernon

[toc] | [prev] | [next] | [standalone]


#5039

FromPhil Carmody <thefatphil_demunged@yahoo.co.uk>
Date2011-05-30 11:01 +0300
Message-ID<8762ossjkn.fsf@bazspaz.fatphil.org>
In reply to#4949
Angel <angel+news@spamcop.net> writes:
> On 2011-05-28, Phil Carmody <thefatphil_demunged@yahoo.co.uk> wrote:
> > Angel <angel+news@spamcop.net> writes:
> >> On 2011-05-26, Duncan Bayne <dhgbayne@gmail.com> wrote:
> >> > 4. Emacs
> >> 
> >> Vi IMproved for me, but whatever works. The Linux kernel folks seem not
> >> too fond of emacs' default layout for C though, just saying...
> >
> > I don't think I've ever see emacs' "linux" style do anything not 
> > approved by the coding standard. Some things aren't specified too 
> > accurately, so emacs may produce different indentation for multi-line
> > if conditions, for example, but there's no right and wrong in those
> > few cases.
> >
> > I guess a straw poll of the half of the kernel team where I worked
> > would have yielded about 50% emacs-alike, 40% vi-alike, 10% other.
> > From their patches, I was never able to tell which was which.
> 
> Coding style is quite a personal thing, and I don't think there is a
> real right or wrong in that. It was just something I came across while
> browsing through the kernel documentation.

Then you should have encountered Documentation/CodingStyle and realised
that it's not a personal thing, it's a Linus thing, and anyone who does
different is wrong. And quite probably stupid too, knowing Linus.

> I like putting my accolades on separate lines so I can clearly see
> where blocks begin and end, but others like to put their opening
> accolade at the end of the if/while/for/function. Like I said earlier,
> whatever works for you. :-)

Were I to code using my prefered coding style, as one of the gatekeepers
of our company kernel, I'd then have to reject all my patches and ask 
myself to do them again. So no, when it comes to linux kernel programming,
it's whatever works for upstream that matters.

Phil
-- 
"At least you know where you are with Microsoft."
"True. I just wish I'd brought a paddle." -- Matthew Vernon

[toc] | [prev] | [next] | [standalone]


#5041

FromAngel <angel+news@spamcop.net>
Date2011-05-30 08:51 +0000
Message-ID<slrniu6mjt.d65.angel+news@pearlgates.net>
In reply to#5039
On 2011-05-30, Phil Carmody <thefatphil_demunged@yahoo.co.uk> wrote:
> Angel <angel+news@spamcop.net> writes:
>> 
>> Coding style is quite a personal thing, and I don't think there is a
>> real right or wrong in that. It was just something I came across while
>> browsing through the kernel documentation.
>
> Then you should have encountered Documentation/CodingStyle and realised
> that it's not a personal thing, it's a Linus thing, and anyone who does
> different is wrong. And quite probably stupid too, knowing Linus.

I've never personally dealt with Linus, but I've read the stories, and
seen the flamewars on LKML. The only "famous" Linux people I've had
personal encounters with (Andrew Morton and David Miller, while analyzing
and solving a bug I had reported) were much more relaxed, IMHO anyway.

>> I like putting my accolades on separate lines so I can clearly see
>> where blocks begin and end, but others like to put their opening
>> accolade at the end of the if/while/for/function. Like I said earlier,
>> whatever works for you. :-)
>
> Were I to code using my prefered coding style, as one of the gatekeepers
> of our company kernel, I'd then have to reject all my patches and ask 
> myself to do them again. So no, when it comes to linux kernel programming,
> it's whatever works for upstream that matters.

As long as it's readable, not too confusing and does what it should do,
it doesn't really matter where exactly that curly brace is, right?


-- 
"C provides a programmer with more than enough rope to hang himself.
C++ provides a firing squad, blindfold and last cigarette."
- seen in comp.lang.c

[toc] | [prev] | [next] | [standalone]


#5065

FromNobody <nobody@nowhere.com>
Date2011-05-31 01:54 +0100
Message-ID<pan.2011.05.31.00.53.53.828000@nowhere.com>
In reply to#5041
On Mon, 30 May 2011 08:51:09 +0000, Angel wrote:

> As long as it's readable, not too confusing and does what it should do,
> it doesn't really matter where exactly that curly brace is, right?

Wrong.

On any large project, it's important that there's a single formatting
style used throughout the project. Otherwise, the next time that
someone edits the code using the correct style, you end up with noise in
the diffs which can make it hard to discern the substantive changes from
the formatting corrections.

Also, rigid adherence to a coding convention helps weed out people who
aren't team players at an early stage.

[toc] | [prev] | [next] | [standalone]


#5099

FromAngel <angel+news@spamcop.net>
Date2011-05-31 12:00 +0000
Message-ID<slrniu9m3g.kkg.angel+news@pearlgates.net>
In reply to#5065
On 2011-05-31, Nobody <nobody@nowhere.com> wrote:
> On Mon, 30 May 2011 08:51:09 +0000, Angel wrote:
>
>> As long as it's readable, not too confusing and does what it should do,
>> it doesn't really matter where exactly that curly brace is, right?
>
> Wrong.
>
> On any large project, it's important that there's a single formatting
> style used throughout the project. Otherwise, the next time that
> someone edits the code using the correct style, you end up with noise in
> the diffs which can make it hard to discern the substantive changes from
> the formatting corrections.
>
> Also, rigid adherence to a coding convention helps weed out people who
> aren't team players at an early stage.

Mm, I suppose you have some valid points there. Thanks for pointing that
out to me, I never looked at it that way.


-- 
"C provides a programmer with more than enough rope to hang himself.
C++ provides a firing squad, blindfold and last cigarette."
- seen in comp.lang.c

[toc] | [prev] | [next] | [standalone]


#5119

FromSeebs <usenet-nospam@seebs.net>
Date2011-05-31 16:44 +0000
Message-ID<slrniua65c.1nek.usenet-nospam@guild.seebs.net>
In reply to#5099
On 2011-05-31, Angel <angel+news@spamcop.net> wrote:
> Mm, I suppose you have some valid points there. Thanks for pointing that
> out to me, I never looked at it that way.

The interesting part is that it still doesn't actually matter where the
braces are, just that they're consistent.

It's like which side of the road you drive on.  It's not actually known
to be significant, but it helps immensely if everyone on a given road agrees.

-s
-- 
Copyright 2011, all wrongs reversed.  Peter Seebach / usenet-nospam@seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
I am not speaking for my employer, although they do rent some of my opinions.

[toc] | [prev] | [next] | [standalone]


#5135

FromKeith Thompson <kst-u@mib.org>
Date2011-05-31 11:43 -0700
Message-ID<lnlixmogmb.fsf@nuthaus.mib.org>
In reply to#5119
Seebs <usenet-nospam@seebs.net> writes:
> On 2011-05-31, Angel <angel+news@spamcop.net> wrote:
>> Mm, I suppose you have some valid points there. Thanks for pointing that
>> out to me, I never looked at it that way.
>
> The interesting part is that it still doesn't actually matter where the
> braces are, just that they're consistent.
>
> It's like which side of the road you drive on.  It's not actually known
> to be significant, but it helps immensely if everyone on a given road agrees.

Indeed.  I've worked under some code layout standards that I find
extremely ugly, but having parts of the code in my own preferred style
would be far worse.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Nokia
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

[toc] | [prev] | [next] | [standalone]


#4793

FromChris H <chris@phaedsys.org>
Date2011-05-26 11:13 +0100
Message-ID<dxOJ0qGyei3NFAmn@phaedsys.demon.co.uk>
In reply to#4783
In message <C-20110526054222@ram.dialup.fu-berlin.de>, Stefan Ram
<ram@zedat.fu-berlin.de> writes
>Duncan Bayne <dhgbayne@gmail.com> writes:
>>1. comp.lang.c
>
>  Usenet is dying. (Some people say.)

Sadly true.

>Try Twitter?

Orrible :-(

>
>  (Oh, I see you are not using a real newsgroup client,
>  but Google Groups, so you already support the Web!)
>
>>2. ANSI C wherever possible (but C89 as C99 isn't that widely
>>supported)
>
>  ISO C.

ISO-C95 NOT C99
However ISO C 12 may be an improvement.

>>3. `gcc -Wall -ansi -pedantic` in lieu of static analysis tools

No. Use a proper static analyser.

>>4. Emacs

Editor etc is personal preference.


-- 
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills  Staffs  England     /\/\/\/\/
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/


[toc] | [prev] | [next] | [standalone]


#4799

FromFrancois Grieu <fgrieu@gmail.com>
Date2011-05-26 16:04 +0200
Message-ID<4dde5e06$0$20221$426a34cc@news.free.fr>
In reply to#4783
On 26/05/2011 05:27, Duncan Bayne wrote:
> Can anyone who's been writing in C for the past eleven years
> let me know what (if anything;-)  ) has changed over the years?

In my experience, both the robustness and code quality of
mainstream compilers (including but not limited to GCC 4,
MS Visual C, Keil C for ARM) has vastly improved.
You'll still often find ugly bugs [1] with these, but very
rarely in the worse category: "generate wrong code".

You can now expect the most obvious optimizations to be
automatically applied [2][3], and will on occasions be surprised
(e.g. by removal of code that is dead only at second glance).

For many of these compiler, inline, __inline, __forceinline
or whatever it is called works, and when ISO C 90
conformance is not necessary, is better than macros.

One the other hand, compilers for less mainstream embedded
platforms must still be expected to generate code that is
badly suboptimal and often wrong.

   Francois Grieu


[1] for example compiling these two lines
     #if 1?1?1:1:1
     #endif
with MS Visual C gives:
fatal error C1017: invalid integer constant expression



[2] many compilers optimize
     for(j=0;j<10;++i)
         foo();
into the obvious code for
     j=0;
     do
         foo();
     while(++j<10);



[3] some compilers know that, when j is an int,
     if (j<1 || j>8)
         foo();
can be rewritten as
     if ((unsigned)j-1u>7u)
         foo();
[fix typo; compilers should do optimization]

[toc] | [prev] | [next] | [standalone]


#4800

FromBranimir Maksimovic <bmaxa@hotmail.com>
Date2011-05-26 16:21 +0200
Message-ID<irlnd3$32t$1@solani.org>
In reply to#4799
On 05/26/2011 04:04 PM, Francois Grieu wrote:
> [3] some compilers know that, when j is an int,
> if (j<1 || j>8)
> foo();
> can be rewritten as
> if ((unsigned)j-1u>7u)
> foo();

No, it can;t.

[toc] | [prev] | [next] | [standalone]


#4802

FromFrancois Grieu <fgrieu@gmail.com>
Date2011-05-26 17:23 +0200
Message-ID<4dde7054$0$5886$426a74cc@news.free.fr>
In reply to#4800
On 26/05/2011 16:21, Branimir Maksimovic wrote:
> On 05/26/2011 04:04 PM, Francois Grieu wrote:
>> [3] some compilers know that, when j is an int,
>> if (j<1 || j>8)
>>     foo();
>> can be rewritten as
>>     if ((unsigned)j-1u>7u)
>>         foo();
>
> No, it can't.

Would you please illustrate by an example when that does not stand?
Stick to C99, please.

   Francois Grieu


Note: my version of GCC makes VERY good code for

#include <limits.h>
#include <stdio.h>
int main(void)
     {
     int j;
     j=INT_MIN;
     for(;;)
         {
         if ((j<1 || j>8) != ((unsigned)j-1u>7u))
             {
             printf("%d\n",j);
             return 1;
             }
         if (j==INT_MAX)
             break;
         ++j;
         }
     return 0;
     }

[toc] | [prev] | [next] | [standalone]


#4807

FromBranimir Maksimovic <bmaxa@hotmail.com>
Date2011-05-26 19:15 +0200
Message-ID<irm1re$316$1@solani.org>
In reply to#4802
On Thu, 26 May 2011 17:23:01 +0200
Francois Grieu <fgrieu@gmail.com> wrote:

> On 26/05/2011 16:21, Branimir Maksimovic wrote:
> > On 05/26/2011 04:04 PM, Francois Grieu wrote:
> >> [3] some compilers know that, when j is an int,
> >> if (j<1 || j>8)
> >>     foo();
> >> can be rewritten as
> >>     if ((unsigned)j-1u>7u)
> >>         foo();
> >
> > No, it can't.
> 
> Would you please illustrate by an example when that does not stand?

When j is in range [-8 , 0]

Actually: if(j < -8 || j > 8)
can be rewritten as: if((unsigned)j>8)


-- 
drwx------ 2 bmaxa bmaxa 4096 2011-05-26 19:00 .

[toc] | [prev] | [next] | [standalone]


#4808

FromWillem <willem@toad.stack.nl>
Date2011-05-26 17:29 +0000
Message-ID<slrnitt3g2.2ldj.willem@toad.stack.nl>
In reply to#4807
Branimir Maksimovic wrote:
) On Thu, 26 May 2011 17:23:01 +0200
) Francois Grieu <fgrieu@gmail.com> wrote:
)
)> On 26/05/2011 16:21, Branimir Maksimovic wrote:
)> > On 05/26/2011 04:04 PM, Francois Grieu wrote:
)> >> [3] some compilers know that, when j is an int,
)> >> if (j<1 || j>8)
)> >>     foo();
)> >> can be rewritten as
)> >>     if ((unsigned)j-1u>7u)
)> >>         foo();
)> >
)> > No, it can't.
)> 
)> Would you please illustrate by an example when that does not stand?
)
) When j is in range [-8 , 0]
)
) Actually: if(j < -8 || j > 8)
) can be rewritten as: if((unsigned)j>8)

Is this meant to be some kind of joke ?


SaSW, Willem
-- 
Disclaimer: I am in no way responsible for any of the statements
            made in the above text. For all I know I might be
            drugged or something..
            No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT

[toc] | [prev] | [next] | [standalone]


#4815

FromBranimir Maksimovic <bmaxa@hotmail.com>
Date2011-05-26 20:10 +0200
Message-ID<irm526$316$3@solani.org>
In reply to#4808
On Thu, 26 May 2011 17:29:38 +0000 (UTC)
Willem <willem@toad.stack.nl> wrote:

> Branimir Maksimovic wrote:
> ) On Thu, 26 May 2011 17:23:01 +0200
> ) Francois Grieu <fgrieu@gmail.com> wrote:
> )
> )> On 26/05/2011 16:21, Branimir Maksimovic wrote:
> )> > On 05/26/2011 04:04 PM, Francois Grieu wrote:
> )> >> [3] some compilers know that, when j is an int,
> )> >> if (j<1 || j>8)
> )> >>     foo();
> )> >> can be rewritten as
> )> >>     if ((unsigned)j-1u>7u)
> )> >>         foo();
> )> >
> )> > No, it can't.
> )> 
> )> Would you please illustrate by an example when that does not stand?
> )
> ) When j is in range [-8 , 0]
> )
> ) Actually: if(j < -8 || j > 8)
> ) can be rewritten as: if((unsigned)j>8)
> 
> Is this meant to be some kind of joke ?
> 

No, I didn;t know how casting from signed to unsigned works.

-- 
drwx------ 2 bmaxa bmaxa 4096 2011-05-26 20:06 .

[toc] | [prev] | [next] | [standalone]


#4809

FromPierre Habouzit <madcoder@debian.org>
Date2011-05-26 17:35 +0000
Message-ID<slrnitt3qo.dfg.madcoder@apollon.madism.org>
In reply to#4807
On 2011-05-26, Branimir Maksimovic <bmaxa@hotmail.com> wrote:
> On Thu, 26 May 2011 17:23:01 +0200
> Francois Grieu <fgrieu@gmail.com> wrote:
>
>> On 26/05/2011 16:21, Branimir Maksimovic wrote:
>> > On 05/26/2011 04:04 PM, Francois Grieu wrote:
>> >> [3] some compilers know that, when j is an int,
>> >> if (j<1 || j>8)
>> >>     foo();
>> >> can be rewritten as
>> >>     if ((unsigned)j-1u>7u)
>> >>         foo();
>> >
>> > No, it can't.
>> 
>> Would you please illustrate by an example when that does not stand?
>
> When j is in range [-8 , 0]

C99 doesn't assure you both are equivalent. I think what Francois tries
to say is that gcc can produce assembly that will do the same as

    if ((unsigned)j - 1u > 7u)

and that's indeed what GCC does, since on the architectures GCC targets
with the implementation choices it makes, both are equivalent.
-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org

[toc] | [prev] | [next] | [standalone]


#4810

FromWillem <willem@toad.stack.nl>
Date2011-05-26 17:53 +0000
Message-ID<slrnitt4t5.2qh5.willem@toad.stack.nl>
In reply to#4809
Pierre Habouzit wrote:
) On 2011-05-26, Branimir Maksimovic <bmaxa@hotmail.com> wrote:
)> On Thu, 26 May 2011 17:23:01 +0200
)> Francois Grieu <fgrieu@gmail.com> wrote:
)>
)>> On 26/05/2011 16:21, Branimir Maksimovic wrote:
)>> > On 05/26/2011 04:04 PM, Francois Grieu wrote:
)>> >> [3] some compilers know that, when j is an int,
)>> >> if (j<1 || j>8)
)>> >>     foo();
)>> >> can be rewritten as
)>> >>     if ((unsigned)j-1u>7u)
)>> >>         foo();
)>> >
)>> > No, it can't.
)>> 
)>> Would you please illustrate by an example when that does not stand?
)>
)> When j is in range [-8 , 0]
)
) C99 doesn't assure you both are equivalent.

Are you sure ?  As far as I know, casting a signed integer to unsigned
is defined for negative numbers as being INT_MAX minus that number.


SaSW, Willem
-- 
Disclaimer: I am in no way responsible for any of the statements
            made in the above text. For all I know I might be
            drugged or something..
            No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT

[toc] | [prev] | [next] | [standalone]


#4816

FromMalcolm McLean <malcolm.mclean5@btinternet.com>
Date2011-05-26 11:13 -0700
Message-ID<72038602-25be-4e08-8c55-fd135b0faabc@w21g2000yqm.googlegroups.com>
In reply to#4810
On May 26, 8:53 pm, Willem <wil...@toad.stack.nl> wrote:
> Pierre Habouzit wrote:
>
> ) On 2011-05-26, Branimir Maksimovic <bm...@hotmail.com> wrote:
> )> On Thu, 26 May 2011 17:23:01 +0200
> )> Francois Grieu <fgr...@gmail.com> wrote:
> )>
> )>> On 26/05/2011 16:21, Branimir Maksimovic wrote:
> )>> > On 05/26/2011 04:04 PM, Francois Grieu wrote:
> )>> >> [3] some compilers know that, when j is an int,
> )>> >> if (j<1 || j>8)
> )>> >>     foo();
> )>> >> can be rewritten as
> )>> >>     if ((unsigned)j-1u>7u)
> )>> >>         foo();
> )>> >
> )>> > No, it can't.
> )>>
> )>> Would you please illustrate by an example when that does not stand?
> )>
> )> When j is in range [-8 , 0]
> )
> ) C99 doesn't assure you both are equivalent.
>
> Are you sure ?  As far as I know, casting a signed integer to unsigned
> is defined for negative numbers as being INT_MAX minus that number.
>
Plus one.
Invert and increment to negate, in twos complememnt
--
MiniBasic - how to write a script interpreter
http://www.lulu.com/bgy1mm

[toc] | [prev] | [next] | [standalone]


#4857

FromJames Kuyper <jameskuyper@verizon.net>
Date2011-05-26 21:57 -0400
Message-ID<irn0ei$4mv$1@dont-email.me>
In reply to#4816
On 05/26/2011 02:13 PM, Malcolm McLean wrote:
> On May 26, 8:53�pm, Willem <wil...@toad.stack.nl> wrote:
...
>> Are you sure ? �As far as I know, casting a signed integer to unsigned
>> is defined for negative numbers as being INT_MAX minus that number.
>>
> Plus one.
> Invert and increment to negate, in twos complememnt

That's UINT_MAX, not INT_MAX. And it's true whether or not 'int' is a
2's complement type; the rule is simply easier to implement in 2's
complement.
-- 
James Kuyper

[toc] | [prev] | [next] | [standalone]


Page 3 of 8 — ← Prev page 1 2 [3] 4 5 6 7 8  Next page →

Back to top | Article view | comp.lang.c


csiph-web