Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #13366
| From | BCFD36 <bcfd36@cruzio.com> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: Simultaneous read and write on a variable in C++ |
| Date | 2012-01-14 01:52 -0800 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <jerj8d$utn$1@speranza.aioe.org> (permalink) |
| References | <ae69a579-bcc6-4583-a40b-83eb33a0bdea@r16g2000yqi.googlegroups.com> |
On 1/11/12 9:08 AM, Novice Coder wrote:
> Here is the code
>
> int main()
> {
> char *p;
> char a[]={"Hello"};
> (p=a)[0]; // This line
> return 0;
> }
>
> Is the behaviour of this code undefined in C++?
I read the whole thread. I'll never get those minutes back. Whether or
not it is well defined is not relevant except maybe in an academic
sense. The code is crap. Posit that it is well defined. So what. It is
obscure. It is opaque. There are other ways to make it clearer what you
want to do. This looks like something designed to try to break the compiler.
Just because something is legal, well defined, and you saw it somewhere
doesn't make it a good idea.
--
Dave Scruggs
Back to comp.lang.c++ | Previous | Next — Previous in thread | Find similar | Unroll thread
Simultaneous read and write on a variable in C++ Novice Coder <extngg1@gmail.com> - 2012-01-11 09:08 -0800
Re: Simultaneous read and write on a variable in C++ Victor Bazarov <v.bazarov@comcast.invalid> - 2012-01-11 12:28 -0500
Re: Simultaneous read and write on a variable in C++ Victor Bazarov <v.bazarov@comcast.invalid> - 2012-01-12 13:07 -0500
Re: Simultaneous read and write on a variable in C++ Prasoon Saurav <prasoonsaurav.nit@gmail.com> - 2012-01-12 10:11 -0800
Re: Simultaneous read and write on a variable in C++ Leigh Johnston <leigh@i42.co.uk> - 2012-01-12 18:46 +0000
Re: Simultaneous read and write on a variable in C++ Prasoon Saurav <prasoonsaurav.nit@gmail.com> - 2012-01-12 11:18 -0800
Re: Simultaneous read and write on a variable in C++ Leigh Johnston <leigh@i42.co.uk> - 2012-01-12 19:28 +0000
Re: Simultaneous read and write on a variable in C++ Leigh Johnston <leigh@i42.co.uk> - 2012-01-12 19:41 +0000
Re: Simultaneous read and write on a variable in C++ Prasoon Saurav <prasoonsaurav.nit@gmail.com> - 2012-01-12 11:46 -0800
Re: Simultaneous read and write on a variable in C++ Prasoon Saurav <prasoonsaurav.nit@gmail.com> - 2012-01-12 11:44 -0800
Re: Simultaneous read and write on a variable in C++ Leigh Johnston <leigh@i42.co.uk> - 2012-01-12 19:46 +0000
Re: Simultaneous read and write on a variable in C++ Leigh Johnston <leigh@i42.co.uk> - 2012-01-12 19:53 +0000
Re: Simultaneous read and write on a variable in C++ Prasoon Saurav <prasoonsaurav.nit@gmail.com> - 2012-01-12 12:01 -0800
Re: Simultaneous read and write on a variable in C++ Leigh Johnston <leigh@i42.co.uk> - 2012-01-12 20:10 +0000
Re: Simultaneous read and write on a variable in C++ Prasoon Saurav <prasoonsaurav.nit@gmail.com> - 2012-01-12 12:13 -0800
Re: Simultaneous read and write on a variable in C++ Leigh Johnston <leigh@i42.co.uk> - 2012-01-12 20:31 +0000
Re: Simultaneous read and write on a variable in C++ scott@slp53.sl.home (Scott Lurndal) - 2012-01-13 18:12 +0000
Re: Simultaneous read and write on a variable in C++ Prasoon Saurav <prasoonsaurav.nit@gmail.com> - 2012-01-12 11:37 -0800
Re: Simultaneous read and write on a variable in C++ Leigh Johnston <leigh@i42.co.uk> - 2012-01-12 19:56 +0000
Re: Simultaneous read and write on a variable in C++ Prasoon Saurav <prasoonsaurav.nit@gmail.com> - 2012-01-12 11:58 -0800
Re: Simultaneous read and write on a variable in C++ Leigh Johnston <leigh@i42.co.uk> - 2012-01-12 20:04 +0000
Re: Simultaneous read and write on a variable in C++ Juha Nieminen <nospam@thanks.invalid> - 2012-01-13 06:34 +0000
Re: Simultaneous read and write on a variable in C++ SG <s.gesemann@gmail.com> - 2012-01-11 13:11 -0800
Re: Simultaneous read and write on a variable in C++ Calum <spambox@calumgrant.net> - 2012-01-11 13:18 -0800
Re: Simultaneous read and write on a variable in C++ Prasoon Saurav <prasoonsaurav.nit@gmail.com> - 2012-01-12 03:11 -0800
Re: Simultaneous read and write on a variable in C++ "Fred Zwarts \(KVI\)" <F.Zwarts@KVI.nl> - 2012-01-12 16:35 +0100
Re: Simultaneous read and write on a variable in C++ Prasoon Saurav <prasoonsaurav.nit@gmail.com> - 2012-01-12 08:06 -0800
Re: Simultaneous read and write on a variable in C++ gwowen <gwowen@gmail.com> - 2012-01-12 07:48 -0800
Re: Simultaneous read and write on a variable in C++ Prasoon Saurav <prasoonsaurav.nit@gmail.com> - 2012-01-12 07:55 -0800
Re: Simultaneous read and write on a variable in C++ Gareth Owen <gwowen@gmail.com> - 2012-01-12 19:36 +0000
Re: Simultaneous read and write on a variable in C++ Victor Bazarov <v.bazarov@comcast.invalid> - 2012-01-12 16:31 -0500
Re: Simultaneous read and write on a variable in C++ Nick Keighley <nick_keighley_nospam@hotmail.com> - 2012-01-13 02:05 -0800
Re: Simultaneous read and write on a variable in C++ Goran <goran.pusic@gmail.com> - 2012-01-13 04:24 -0800
Re: Simultaneous read and write on a variable in C++ Prasoon Saurav <prasoonsaurav.nit@gmail.com> - 2012-01-13 04:52 -0800
Re: Simultaneous read and write on a variable in C++ Leigh Johnston <leigh@i42.co.uk> - 2012-01-12 12:39 +0000
Re: Simultaneous read and write on a variable in C++ Leigh Johnston <leigh@i42.co.uk> - 2012-01-12 12:50 +0000
Re: Simultaneous read and write on a variable in C++ Leigh Johnston <leigh@i42.co.uk> - 2012-01-12 12:58 +0000
Re: Simultaneous read and write on a variable in C++ Prasoon Saurav <prasoon@parallocity.com> - 2012-01-12 05:55 -0800
Re: Simultaneous read and write on a variable in C++ Leigh Johnston <leigh@i42.co.uk> - 2012-01-12 13:59 +0000
Re: Simultaneous read and write on a variable in C++ Prasoon Saurav <prasoon@parallocity.com> - 2012-01-12 06:14 -0800
Re: Simultaneous read and write on a variable in C++ Leigh Johnston <leigh@i42.co.uk> - 2012-01-12 14:30 +0000
Re: Simultaneous read and write on a variable in C++ Juha Nieminen <nospam@thanks.invalid> - 2012-01-12 14:34 +0000
Re: Simultaneous read and write on a variable in C++ Prasoon Saurav <prasoon@parallocity.com> - 2012-01-12 05:54 -0800
Re: Simultaneous read and write on a variable in C++ BCFD36 <bcfd36@cruzio.com> - 2012-01-14 01:52 -0800
csiph-web