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


Groups > comp.lang.c > #20853

Re: A question for this group...

From nick_keighley_nospam@hotmail.com
Newsgroups comp.lang.c
Subject Re: A question for this group...
Date 2012-05-16 03:53 -0700
Organization http://groups.google.com
Message-ID <15497347.287.1337165607109.JavaMail.geo-discussion-forums@vbk4> (permalink)
References <jou4fd$5uh$1@news.xmission.com>

Show all headers | View raw


On Tuesday, May 15, 2012 6:41:01 PM UTC+1, Kenny McCormack wrote:

> 	Why does it hurt when I stick my finger in a light socket?
> 
> Is it universally true that the only possible answer is:
> 
> 	Don't stick your fingers in light sockets.

it might be interesting to discuss why it hurts. But it would also be a good idea to make sure the questioner knew this was a really dangerous thing to do. More dangerous than writing code like

printf("%d %d %d",a++,a++,++a); 

(I actually know someone who has a couple of fingers missing from sticking his fingers in an electrical socket.)

> Is it really true that an explanation of how electricity works and how your
> body is a conductor (and, in particular, how the real issue is how well
> grounded your body is) is never appropriate?
> 
> This seems to be the attitude of this group - see in particular the recent
> "Program Output" thread.

unsurprisingly I disagree. The C programmer language is defined by an abstract specification. Certain parts are left undefined. There the implementor has choice. It is meaningless to ask for a detailed explanation of the behaviour of a program that has strayed into such regions unless you also know a great deal about the particular implementation. With optimising compilers this could be really hard.

For instance *I'd* expect a straitforward implementation to produce "7 6 6". But I see I was wrong. How do you explain the output observed? Visual C++ produces this output.

I suppose we could explain /why/ this has been left as UB. And discuss aliasing and sequence points and so on, but does this really help the OP?

I know Kenny knows all this stuff but I thought the question was mildly interesting. Maybe a lurker will be enlightened.

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