Saturday, August 7, 2021

Digest for comp.lang.c++@googlegroups.com - 9 updates in 3 topics

Tim Rentsch <tr.17687@z991.linuxsc.com>: Aug 07 01:06PM -0700

>>> code. That is the only scalable option.
 
>> Virtual function calls are more scalable.
 
> Wrong, the NUMBER of functions needed grows way to fast to be scalable.
 
It might, but it doesn't have to. The number of functions
needed depends on the class hierarchy.
Tim Rentsch <tr.17687@z991.linuxsc.com>: Aug 07 10:22AM -0700

> that any type that is neither trivially copyable nor a
> standard-layout type need not occupy contiguous bytes of storage.
> C's requirement (6.2.6.1p2) has no such exceptions.
 
Sorry, I thought it was obvious from context that my
question was meant to ask only about contiguous objects.
Tim Rentsch <tr.17687@z991.linuxsc.com>: Aug 07 10:22AM -0700


> Yes in C++ it is so only about pointers to objects of trivially copyable
> or standard-layout types as only those are required to occupy
> contiguous bytes of storage.
 
Sorry, I thought it was obvious from context that my
question was meant to ask only about contiguous objects.
Tim Rentsch <tr.17687@z991.linuxsc.com>: Aug 07 10:25AM -0700


> C++20 (at least in the draft I have) requires 2**CHAR_BIT distinct
> values for the narrow character types (char, unsigned char, signed char,
> and char8_t).
 
Ahhh, as usual for the C++ standard. Yes repeat no.
 
Thank you for the additional information.
Bo Persson <bo@bo-persson.se>: Aug 07 09:21PM +0200

On 2021-08-07 at 19:25, Tim Rentsch wrote:
>> and char8_t).
 
> Ahhh, as usual for the C++ standard. Yes repeat no.
 
> Thank you for the additional information.
 
Things change. :-)
 
 
One difference is that C++20 requires two's complement (in another
section), so it can know what value a bit pattern represents.
"james...@alumni.caltech.edu" <jameskuyper@alumni.caltech.edu>: Aug 07 12:40PM -0700

On Saturday, August 7, 2021 at 1:22:16 PM UTC-4, Tim Rentsch wrote:
> > C's requirement (6.2.6.1p2) has no such exceptions.
> Sorry, I thought it was obvious from context that my
> question was meant to ask only about contiguous objects.
 
No, it wasn't. The statement you made about C is about "any object",
not "contiguous objects". It ceases to be true for C++ precisely
because C++ allows objects to not be contiguous. The context of
that statement was a comparison of arrays and structs, and while
arrays are required to contiguous, structs are not. That discussion, in
turn, evolved from an earlier discussion of offsetof(), which is only
conditionally-supported in C++ for types that aren't standard-layout
types.
Tim Rentsch <tr.17687@z991.linuxsc.com>: Aug 07 12:54PM -0700

> turn, evolved from an earlier discussion of offsetof(), which is only
> conditionally-supported in C++ for types that aren't standard-layout
> types.
 
My statement was and is a true and correct statement.
Tim Rentsch <tr.17687@z991.linuxsc.com>: Aug 07 12:59PM -0700

> and back and still be used. Also I believe that any object can be
> treated as an array of char. So you can do the conversion to char and
> subtract for two pointers in the same object.
 
In C the difference of two pointers might not work, in particular
if the result doesn't fit in ptrdiff_t. I don't know if that
rule is different in C++.
Bo Persson <bo@bo-persson.se>: Aug 07 09:19AM +0200

On 2021-08-06 at 22:49, Vir Campestris wrote:
 
> I'd even forgotten I'm subscribed to them both. There are no recent post
> on either.
 
> Andy
 
That's because the moderation server got lost years ago, so you just
cannot post anything, even if you want to.
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

No comments: