bottom type as parameter or local variable, does that make sense?

H. S. Teoh hsteoh at quickfur.ath.cx
Mon Jan 17 18:41:51 UTC 2022


On Mon, Jan 17, 2022 at 06:32:19PM +0000, Elronnd via Digitalmars-d wrote:
> On Monday, 17 January 2022 at 18:05:49 UTC, H. S. Teoh wrote:
> > > What happens if you pass in an A*, and A.sizeof>B.sizeof?
> > 
> > This is exactly what happens when you pass a derived class to a
> > function that expects the base class, BTW.
> 
> You can't do pointer arithmetic on class instances.

Sure you can. Just cast it to void* and arithmetic away.


T

-- 
One Word to write them all, One Access to find them, One Excel to count them all, And thus to Windows bind them. -- Mike Champion


More information about the Digitalmars-d mailing list