Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #68511
| From | Paavo Helde <myfirstname@osa.pri.ee> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: Strange code-generation |
| Date | 2019-09-18 21:06 +0300 |
| Organization | A noiseless patient Spider |
| Message-ID | <qltrnv$t19$1@dont-email.me> (permalink) |
| References | <qlo0kb$uhe$1@news.albasani.net> <qlo4fl$hv4$1@dont-email.me> <867e654ndj.fsf@linuxsc.com> |
On 18.09.2019 18:47, Tim Rentsch wrote: > Paavo Helde <myfirstname@osa.pri.ee> writes: >> >> In standard C++ one cannot legally construct a "null reference", so >> the standard cannot mandate any behavior regarding them. [...] > > Sure it could. The Standard doesn't say that they can't exist, > and even if they couldn't exist the Standard could still specify > a behavior for how they must be treated. And it might even be > useful to give such a specification, for implementations that > choose to provide null references by means of an extension. By that logic the C++ standard could also prescribe how the SQL language or the invisible unicorn in my garage must behave, in the case someone happens to incorporate them into their C++ implementation. More to the point, the standard contains the following verbiage: "A reference shall be initialized to refer to a valid object or function. [ Note: in particular, a null reference cannot exist in a well-defined program, because the only way to create such a reference would be to bind it to the “object” obtained by indirection through a null pointer, which causes undefined behavior. ]" Without contradicting itself, the standard cannot say in one place "A reference shall be initialized to refer to a valid object" and "behavior is undefined" and then go on and discuss in another place what happens if a program violates this "shall", thus defining the behavior.
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Strange code-generation Bonita Montero <Bonita.Montero@gmail.com> - 2019-09-16 14:53 +0200
Re: Strange code-generation Paavo Helde <myfirstname@osa.pri.ee> - 2019-09-16 16:59 +0300
Re: Strange code-generation Bonita Montero <Bonita.Montero@gmail.com> - 2019-09-16 21:08 +0200
Re: Strange code-generation Tim Rentsch <tr.17687@z991.linuxsc.com> - 2019-09-18 08:47 -0700
Re: Strange code-generation Paavo Helde <myfirstname@osa.pri.ee> - 2019-09-18 21:06 +0300
Re: Strange code-generation Tim Rentsch <tr.17687@z991.linuxsc.com> - 2019-11-09 05:52 -0800
Re: Strange code-generation "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2019-11-09 19:15 +0100
Re: Strange code-generation Bonita Montero <Bonita.Montero@gmail.com> - 2019-09-19 19:05 +0200
Re: Strange code-generation David Brown <david.brown@hesbynett.no> - 2019-09-19 19:34 +0200
Re: Strange code-generation Bonita Montero <Bonita.Montero@gmail.com> - 2019-09-19 20:05 +0200
Re: Strange code-generation Paavo Helde <myfirstname@osa.pri.ee> - 2019-09-19 22:00 +0300
Re: Strange code-generation David Brown <david.brown@hesbynett.no> - 2019-09-20 08:21 +0200
csiph-web