Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #7810
| From | Victor Bazarov <v.bazarov@comcast.invalid> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: removing constness of a true const |
| Date | 2011-07-14 11:55 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <ivn3hs$tk2$1@dont-email.me> (permalink) |
| References | <1e55c267-2789-498c-a5a1-f56e499336e5@z12g2000yqj.googlegroups.com> |
On 7/14/2011 11:07 AM, siddhu wrote: > I guess removing constness of a true const( I guess it is also called > bitwise const ) using const_cast is undefined behavior. Can you > please give an example of a true const and may be a sample code which > exhibits undefined behavior by removing constness of a true const. Homework? Interview question? A literal is usually a "true const". So, trying to remove const from the literal and then change it does have undefined behavior. Give the example that uses a literal, and you'll solve your own homework. V -- I do not respond to top-posted replies, please don't ask
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
removing constness of a true const siddhu <siddharth.sng@gmail.com> - 2011-07-14 08:07 -0700
Re: removing constness of a true const Victor Bazarov <v.bazarov@comcast.invalid> - 2011-07-14 11:55 -0400
Re: removing constness of a true const siddhu <siddharth.sng@gmail.com> - 2011-07-14 09:25 -0700
Re: removing constness of a true const Victor Bazarov <v.bazarov@comcast.invalid> - 2011-07-14 16:18 -0400
Re: removing constness of a true const "Balog Pal" <pasa@lib.hu> - 2011-07-15 01:18 +0200
Re: removing constness of a true const Victor Bazarov <v.bazarov@comcast.invalid> - 2011-07-15 08:17 -0400
Re: removing constness of a true const "Balog Pal" <pasa@lib.hu> - 2011-07-15 18:04 +0200
Re: removing constness of a true const Ian Collins <ian-news@hotmail.com> - 2011-07-16 08:36 +1200
Re: removing constness of a true const "Balog Pal" <pasa@lib.hu> - 2011-07-16 02:00 +0200
Re: removing constness of a true const Paavo Helde <myfirstname@osa.pri.ee> - 2011-07-15 16:08 -0500
Re: removing constness of a true const Ian Collins <ian-news@hotmail.com> - 2011-07-16 09:30 +1200
Re: removing constness of a true const "Balog Pal" <pasa@lib.hu> - 2011-07-14 19:05 +0200
Re: removing constness of a true const siddhu <siddharth.sng@gmail.com> - 2011-07-14 12:05 -0700
Re: removing constness of a true const "Bo Persson" <bop@gmb.dk> - 2011-07-14 23:33 +0200
Re: removing constness of a true const Victor Bazarov <v.bazarov@comcast.invalid> - 2011-07-14 17:46 -0400
Re: removing constness of a true const "Bo Persson" <bop@gmb.dk> - 2011-07-16 08:32 +0200
Re: removing constness of a true const "Johannes Schaub (litb)" <schaub.johannes@googlemail.com> - 2011-07-15 15:02 +0200
Re: removing constness of a true const Victor Bazarov <v.bazarov@comcast.invalid> - 2011-07-15 09:54 -0400
csiph-web