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


Groups > comp.lang.c > #14211

Re: sequence points and printf()

From Kaz Kylheku <kaz@kylheku.com>
Newsgroups comp.lang.c
Subject Re: sequence points and printf()
Date 2011-12-02 02:09 +0000
Organization A noiseless patient Spider
Message-ID <20111201173215.831@kylheku.com> (permalink)
References <4ed7195d$0$294$14726298@news.sunsite.dk> <jb8uds$tl8$1@dont-email.me> <jb98o5$u0b$1@dont-email.me>

Show all headers | View raw


On 2011-12-02, James Kuyper <jameskuyper@verizon.net> wrote:
> On 12/01/2011 05:17 PM, August Karlstrom wrote:
>> On 2011-12-01 07:06, arnuld wrote:
>> [...]
>>> But as per C-FAQs here:  http://c-faq.com/expr/seqpoints.html
>>>
>>> comma operator defined a sequence point and I see comma is present
>>> between printf() arguments but I am not sure if this "comma" is called as
>>> "comma operator" ?
>> 
>> Just want to add that unless you are into code maintenance I see no 
>> point in bothering with sequence points.
>
> I'm curious - if you don't bother with sequence points, how do you write
> C? Any C program has a minimum of at least one sequence point.
>
> Or are you saying you see no point in bothering to understand sequence
> points? In that case, how do you avoid writing code that has undefined
> behavior by reason of not bothering with sequence points?

You can avoid knowledge of sequence points by memorizing some simplified
coding rules instead: in any full expression (such as an expression
statement, initializer, or the controlling expression of a loop, etc) never
modify the same object twice, and never make an ambiguous-looking access to an
object that is being modified (any access to an object being modified
has to be one of the operands of the expressions which compute the new value
being stored).

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


Thread

sequence points and printf() arnuld <sunrise@invalid.address> - 2011-12-01 06:06 +0000
  Re: sequence points and printf() pacman@kosh.dhis.org (Alan Curry) - 2011-12-01 06:13 +0000
  Re: sequence points and printf() Martin Ambuhl <mambuhl@earthlink.net> - 2011-12-01 02:19 -0500
    Re: sequence points and printf() Keith Thompson <kst-u@mib.org> - 2011-12-01 06:55 -0800
      Re: sequence points and printf() pete <pfiland@mindspring.com> - 2011-12-01 11:01 -0500
  Re: sequence points and printf() "BartC" <bc@freeuk.com> - 2011-12-01 11:18 +0000
    Re: sequence points and printf() Keith Thompson <kst-u@mib.org> - 2011-12-01 07:03 -0800
    Re: sequence points and printf() Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-12-01 17:04 +0200
    Re: sequence points and printf() lawrence.jones@siemens.com - 2011-12-01 09:59 -0500
      Re: sequence points and printf() Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-12-01 20:48 -0500
    Re: sequence points and printf() Seebs <usenet-nospam@seebs.net> - 2011-12-01 20:08 +0000
  Re: sequence points and printf() Willem <willem@toad.stack.nl> - 2011-12-01 11:59 +0000
  Re: sequence points and printf() Seebs <usenet-nospam@seebs.net> - 2011-12-01 20:08 +0000
  Re: sequence points and printf() August Karlstrom <fusionfile@gmail.com> - 2011-12-01 23:17 +0100
    Re: sequence points and printf() Keith Thompson <kst-u@mib.org> - 2011-12-01 14:35 -0800
    Re: sequence points and printf() Kaz Kylheku <kaz@kylheku.com> - 2011-12-01 23:02 +0000
    Re: sequence points and printf() James Kuyper <jameskuyper@verizon.net> - 2011-12-01 20:13 -0500
      Re: sequence points and printf() Kaz Kylheku <kaz@kylheku.com> - 2011-12-02 02:09 +0000
        Re: sequence points and printf() August Karlstrom <fusionfile@gmail.com> - 2011-12-03 17:23 +0100
  Re: sequence points and printf() Vincenzo Mercuri <vincenzo.mercuri@hotmail.it> - 2011-12-09 18:33 +0100

csiph-web