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


Groups > comp.lang.c > #22862

Re: A question for this group...

From Neil Cerutti <neilc@norwich.edu>
Newsgroups comp.lang.c
Subject Re: A question for this group...
Date 2012-06-27 13:49 +0000
Organization Norwich University
Message-ID <a50hapFhpkU2@mid.individual.net> (permalink)
References <jou4fd$5uh$1@news.xmission.com> <61803198-a3b7-4cf7-a615-a9941d9393ba@googlegroups.com> <jsa3la$2rs$2@news.xmission.com> <24bb4002-32ec-4fe5-9971-7d9683ad5029@googlegroups.com>

Show all headers | View raw


On 2012-06-26, nick_keighley_nospam@hotmail.com
<nick_keighley_nospam@hotmail.com> wrote:
>> >> 	Don't stick your fingers in light sockets.
>
> this is a poor analogy. We're actually talking about code like 
>
>    printf("%d %d %d",a++,a++,++a); 
>
> and the responses *aren't* "Don't Do That". Its "thats
> undefined behaviour, its outcome can't be usefyully predicted".
> IMHO analysing code like the above for a particular compiler is
> time wasted. Not just for the naive and childish poster (as you
> insist we treat them) but for anyone.

While K&R sometimes urges learners to try out different
strategies to find out what their particular implementation does
with odd constructs, e.g., Exercise 1-2, in this case they agree
with the most common responses in this newsgroup.

They give the technical reason that constructs like this are
undefined, but they further say that knowing the result of
expressions like a[i] = ++i on your implementation is, in fact,
evil.

  The moral is that writing code that depends on order of
  evaluation is a bad programming practice in any language.
  Naturally, it is necessary to know what things to avoid, but if
  you don't know how they are done on various machines you won't
  be tempted to take advantage of a particular implementation.

Do not eat of that fruit, my friends.

-- 
Neil Cerutti

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


Thread

A question for this group... gazelle@shell.xmission.com (Kenny McCormack) - 2012-05-15 17:41 +0000
  Re: A question for this group... "Chine Bleu, Russie Blanche, et Khmer Rouge" <chine.bleu@yahoo.com> - 2012-05-15 10:44 -0700
    Re: A question for this group... James Kuyper <jameskuyper@verizon.net> - 2012-05-15 14:06 -0400
  Re: A question for this group... William Ahern <william@wilbur.25thandClement.com> - 2012-05-15 13:24 -0700
    Re: A question for this group... Quentin Pope <qp19433@hotmail.NOSPAM.com> - 2012-05-15 20:56 +0000
      Re: A question for this group... nick_keighley_nospam@hotmail.com - 2012-05-16 03:41 -0700
  Re: A question for this group... Old Wolf <oldwolf@inspire.net.nz> - 2012-05-16 02:31 -0700
  Re: A question for this group... nick_keighley_nospam@hotmail.com - 2012-05-16 03:53 -0700
    Re: A question for this group... gazelle@shell.xmission.com (Kenny McCormack) - 2012-05-16 14:08 +0000
      Re: A question for this group... Martin Shobe <martin.shobe@yahoo.com> - 2012-05-16 14:49 +0000
        Re: A question for this group... Martin Shobe <martin.shobe@yahoo.com> - 2012-05-16 14:59 +0000
      Re: A question for this group... Kaz Kylheku <kaz@kylheku.com> - 2012-05-16 16:05 +0000
      Re: A question for this group... Old Wolf <oldwolf@inspire.net.nz> - 2012-05-16 14:29 -0700
    Re: A question for this group... Stephen Sprunk <stephen@sprunk.org> - 2012-05-16 18:18 -0500
  Re: A question for this group... Robert Miles <milesrf@Usenet-News.net> - 2012-06-23 23:22 -0500
  Re: A question for this group... Malcolm McLean <malcolm.mclean5@btinternet.com> - 2012-06-25 02:41 -0700
    Re: A question for this group... gazelle@shell.xmission.com (Kenny McCormack) - 2012-06-25 16:29 +0000
      Re: A question for this group... nick_keighley_nospam@hotmail.com - 2012-06-26 08:27 -0700
        Re: A question for this group... gazelle@shell.xmission.com (Kenny McCormack) - 2012-06-27 09:05 +0000
          Re: A question for this group... nick_keighley_nospam@hotmail.com - 2012-06-27 03:57 -0700
        Re: A question for this group... Neil Cerutti <neilc@norwich.edu> - 2012-06-27 13:49 +0000
          Re: A question for this group... "io_x" <a@b.c.invalid> - 2012-06-28 09:19 +0200
            Re: A question for this group... nick_keighley_nospam@hotmail.com - 2012-06-28 01:59 -0700
              Re: A question for this group... Malcolm McLean <malcolm.mclean5@btinternet.com> - 2012-06-28 04:18 -0700
                Re: A question for this group... Heikki Kallasjoki <fis+usenet@zem.fi> - 2012-06-28 12:14 +0000
                Re: A question for this group... James Kuyper <jameskuyper@verizon.net> - 2012-06-28 08:28 -0400
                Re: A question for this group... James Kuyper <jameskuyper@verizon.net> - 2012-06-28 08:33 -0400
                Re: A question for this group... Malcolm McLean <malcolm.mclean5@btinternet.com> - 2012-06-28 13:07 -0700
                Re: A question for this group... David Thompson <dave.thompson2@verizon.net> - 2012-07-19 02:40 -0400
              Re: A question for this group... "io_x" <a@b.c.invalid> - 2012-06-28 18:58 +0200
                Re: A question for this group... Andrew Cooper <amc96@cam.ac.uk> - 2012-06-29 01:11 +0100
                Re: A question for this group... Philip Lantz <prl@canterey.us> - 2012-07-05 00:21 -0700
                Re: A question for this group... nick_keighley_nospam@hotmail.com - 2012-07-06 00:24 -0700
                Re: A question for this group... Tim Rentsch <txr@alumni.caltech.edu> - 2012-07-06 17:43 -0700

csiph-web