Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #7042
| From | "Alf P. Steinbach /Usenet" <alf.p.steinbach+usenet@gmail.com> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: Strict aliasing and buffer handling |
| Date | 2011-06-22 01:43 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <itra0q$b3s$1@dont-email.me> (permalink) |
| References | (8 earlier) <itoekf$9n3$1@hoshi.visyn.net> <itoib9$5v0$1@dont-email.me> <1a99fc9d-66cc-4d00-aa63-211b978a7693@p13g2000yqh.googlegroups.com> <itq90d$onb$1@dont-email.me> <bcbaa639-183a-4b61-b904-64bb34a9a43f@28g2000yqu.googlegroups.com> |
* Francois Duranleau, on 21.06.2011 18:08: > On Jun 21, 10:19 am, "Alf P. Steinbach /Usenet"<alf.p.steinbach > +use...@gmail.com> wrote: >> * Francois Duranleau, on 21.06.2011 14:03: >> >>> On Jun 20, 6:46 pm, "Alf P. Steinbach /Usenet"<alf.p.steinbach >>> +use...@gmail.com> wrote: >>>> * Kai-Uwe Bux, on 20.06.2011 23:38: >> >>>>> What is the flaw? >> >>>> Just as an example that the above list does not cover everything, the intro to >>>> classes says that if class A is a POD, and its first member is a double, say, >>>> then if you have a pointer to an A then you can reinterpret_cast it to pointer >>>> to double to access that first member. It's for C compatibility. >> >>>> And that's not covered by the list, i.e. there's at least one engine stutter: >>>> the list says it's UB, later on in the standard it's said to be well-defined. ;-) >> >>> Well, actually, it is covered by this point: >> >>> "- an aggregate or union type that includes one of the aforementioned >>> types among its members (including, recursively, a member of a >>> subaggregate or contained union)" >> >>> although not very clearly. >> >> You have that backwards. In the example above, an `A` object is accessed as a >> `double`. A `double` is not an aggregate or union. >> >> But presumably you would not have posted the article I'm replying to now, if you >> agreed with that. >> >> However, even if it seems to you to be the other way around, consider that the >> standard's list only works one way, while later on in the standard, a two way >> conversion is defined -- one of those 2 directions is necessarily missing. > > Indeed, I misread your example, sorry. What was I thinking. > > Do you know where in the standard where we can find that two way > conversion definition? $9.2/17 in the current standard, the crucial wording being "and vice versa". Cheers & hth., - Alf -- blog at <url: http://alfps.wordpress.com>
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Strict aliasing and buffer handling Francois Duranleau <xiao.bai.xiong@gmail.com> - 2011-06-20 09:59 -0700
Re: Strict aliasing and buffer handling "Paul" <pchristor@yahoo.co.uk> - 2011-06-20 19:39 +0100
Re: Strict aliasing and buffer handling Francois Duranleau <xiao.bai.xiong@gmail.com> - 2011-06-20 11:56 -0700
Re: Strict aliasing and buffer handling Leigh Johnston <leigh@i42.co.uk> - 2011-06-20 20:12 +0100
Re: Strict aliasing and buffer handling Francois Duranleau <xiao.bai.xiong@gmail.com> - 2011-06-20 12:39 -0700
Re: Strict aliasing and buffer handling Leigh Johnston <leigh@i42.co.uk> - 2011-06-20 20:49 +0100
Re: Strict aliasing and buffer handling "Paul" <pchristor@yahoo.co.uk> - 2011-06-20 21:12 +0100
Re: Strict aliasing and buffer handling Leigh Johnston <leigh@i42.co.uk> - 2011-06-20 21:20 +0100
Re: Strict aliasing and buffer handling "Paul" <pchristor@yahoo.co.uk> - 2011-06-21 10:35 +0100
Re: Strict aliasing and buffer handling Leigh Johnston <leigh@i42.co.uk> - 2011-06-21 12:35 +0100
Re: Strict aliasing and buffer handling "Paul" <pchristor@yahoo.co.uk> - 2011-06-21 12:37 +0100
Re: Strict aliasing and buffer handling "Alf P. Steinbach /Usenet" <alf.p.steinbach+usenet@gmail.com> - 2011-06-20 22:16 +0200
Re: Strict aliasing and buffer handling Francois Duranleau <xiao.bai.xiong@gmail.com> - 2011-06-20 13:29 -0700
Re: Strict aliasing and buffer handling "Alf P. Steinbach /Usenet" <alf.p.steinbach+usenet@gmail.com> - 2011-06-20 23:27 +0200
Re: Strict aliasing and buffer handling Joshua Maurice <joshuamaurice@gmail.com> - 2011-06-20 14:37 -0700
Re: Strict aliasing and buffer handling "Alf P. Steinbach /Usenet" <alf.p.steinbach+usenet@gmail.com> - 2011-06-21 00:31 +0200
Re: Strict aliasing and buffer handling Joshua Maurice <joshuamaurice@gmail.com> - 2011-06-20 19:37 -0700
Re: Strict aliasing and buffer handling Kai-Uwe Bux <jkherciueh@gmx.net> - 2011-06-20 23:38 +0200
Re: Strict aliasing and buffer handling "Alf P. Steinbach /Usenet" <alf.p.steinbach+usenet@gmail.com> - 2011-06-21 00:46 +0200
Re: Strict aliasing and buffer handling Francois Duranleau <xiao.bai.xiong@gmail.com> - 2011-06-21 05:03 -0700
Re: Strict aliasing and buffer handling "Alf P. Steinbach /Usenet" <alf.p.steinbach+usenet@gmail.com> - 2011-06-21 16:19 +0200
Re: Strict aliasing and buffer handling Francois Duranleau <xiao.bai.xiong@gmail.com> - 2011-06-21 09:08 -0700
Re: Strict aliasing and buffer handling "Alf P. Steinbach /Usenet" <alf.p.steinbach+usenet@gmail.com> - 2011-06-22 01:43 +0200
Re: Strict aliasing and buffer handling Joshua Maurice <joshuamaurice@gmail.com> - 2011-06-20 14:49 -0700
Re: Strict aliasing and buffer handling "io_x" <a@b.c.invalid> - 2011-06-21 09:12 +0200
Re: Strict aliasing and buffer handling Ian Collins <ian-news@hotmail.com> - 2011-06-21 20:14 +1200
csiph-web