Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #85955
| From | Andrey Tarasevich <andreytarasevich@hotmail.com> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: `bool` in pointer arithmetic: when does the promotion occur, if ever? |
| Date | 2022-08-16 09:56 -0700 |
| Organization | A noiseless patient Spider |
| Message-ID | <tdgi76$3p1q$1@dont-email.me> (permalink) |
| References | (1 earlier) <tde24g$3o0ua$1@dont-email.me> <tde3ab$3o7iu$1@dont-email.me> <tde69i$3oucq$1@dont-email.me> <tdec2o$3q32d$1@dont-email.me> <tdfg0k$dbm$1@dont-email.me> |
On 8/16/2022 12:12 AM, David Brown wrote: >> >> Secondly, in any case these rules cannot be brushed off under "not >> triggered" premise because the very last rule in the list is a "sink": >> it is not protected by a trigger at all, it is unconditional. If none >> of the previous rules are "triggered" then the last rule applies: >> >> http://eel.is/c++draft/expr.arith.conv#1.3.5 >> - Otherwise, both operands are converted to the unsigned integer >> type corresponding to the type of the operand with signed integer type. >> >> What do you expect this to do if one operand is a pointer? > > It doesn't get that far. As I interpret this, only the bool gets the > "usual arithmetic conversions" - thus references to "both operands" only > apply to the single operand. After the integral promotions are > performed (turning the bool into int), we get "If both operands have the > same type, no further conversion is needed" and stop there. > But... why? Why do we suddenly stop at "If both operands have the same type..."? We have a pointer and a bool. How is that "the same type", even if you promote the bool to an integer? > I'm sorry - I thought it was /you/ who asked the original question, looking for help? And the thanks I get for going through the paragraphs and explaining as best I can how I read the standards, is to get my head bitten off? > > Maybe my understanding of the standards is not quite right. Maybe my explanation wasn't great. But if this is your idea of how to say "I don't see it that way, but thanks for trying", I'll leave you to figure things out some other way. Perhaps someone else will reply to you, and maybe give you a reading that you'd prefer. Well, this was intended as a "language lawyer" kind of question. So, the help I was looking for does not allow for interpretations. I just needed a confirmation that what looks to me as a defect is indeed likely to be a defect. -- Best regards,
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
`bool` in pointer arithmetic: when does the promotion occur, if ever? Andrey Tarasevich <andreytarasevich@hotmail.com> - 2022-08-15 10:45 -0700
Re: `bool` in pointer arithmetic: when does the promotion occur, if ever? David Brown <david.brown@hesbynett.no> - 2022-08-15 20:09 +0200
Re: `bool` in pointer arithmetic: when does the promotion occur, if ever? Andrey Tarasevich <andreytarasevich@hotmail.com> - 2022-08-15 11:29 -0700
Re: `bool` in pointer arithmetic: when does the promotion occur, if ever? Andrey Tarasevich <andreytarasevich@hotmail.com> - 2022-08-15 11:35 -0700
Re: `bool` in pointer arithmetic: when does the promotion occur, if ever? David Brown <david.brown@hesbynett.no> - 2022-08-15 21:20 +0200
Re: `bool` in pointer arithmetic: when does the promotion occur, if ever? red floyd <no.spam.here@its.invalid> - 2022-08-15 13:49 -0700
Re: `bool` in pointer arithmetic: when does the promotion occur, if ever? Andrey Tarasevich <andreytarasevich@hotmail.com> - 2022-08-15 13:59 -0700
Re: `bool` in pointer arithmetic: when does the promotion occur, if ever? David Brown <david.brown@hesbynett.no> - 2022-08-16 09:12 +0200
Re: `bool` in pointer arithmetic: when does the promotion occur, if ever? Andrey Tarasevich <andreytarasevich@hotmail.com> - 2022-08-16 09:56 -0700
Re: `bool` in pointer arithmetic: when does the promotion occur, if ever? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-09-15 07:18 -0700
Re: `bool` in pointer arithmetic: when does the promotion occur, if ever? Language Lawyer <language.lawyer@gmail.com> - 2022-09-19 03:28 -0700
Re: `bool` in pointer arithmetic: when does the promotion occur, if ever? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-10-02 12:37 -0700
Re: `bool` in pointer arithmetic: when does the promotion occur, if ever? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-08-15 14:36 -0700
Re: `bool` in pointer arithmetic: when does the promotion occur, if ever? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2022-08-15 14:57 -0700
Re: `bool` in pointer arithmetic: when does the promotion occur, if ever? "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2022-08-16 21:13 +0200
Re: `bool` in pointer arithmetic: when does the promotion occur, if ever? Language Lawyer <language.lawyer@gmail.com> - 2022-08-17 09:08 -0700
csiph-web