Re: OK to do bit-packing with GC pointers?

2022-08-09 Thread Ali Çehreli via Digitalmars-d-learn
On 7/22/22 09:50, Ben Jones wrote: > any problems with the GC? The slides don't seem to mention the GC but Amaury Séchet had given a presentation on bit packing: http://dconf.org/2016/talks/sechet.html Ali

Re: OK to do bit-packing with GC pointers?

2022-07-23 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Saturday, 23 July 2022 at 08:32:12 UTC, Ola Fosheim Grøstad wrote: Also `char*` can't work as char cannot contain pointers. I guess you would need to use `void*`. Well, that is wrong for the standard collection where the typing is dynamic (based on allocation not on type system). Then any

Re: OK to do bit-packing with GC pointers?

2022-07-23 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Saturday, 23 July 2022 at 00:55:14 UTC, Steven Schveighoffer wrote: Probably. Though like I said, I doubt it matters. Maybe someone with more type theory or GC knowledge knows whether it should be OK or not. Has nothing to do with type theory, only about GC implementation. But his object

Re: OK to do bit-packing with GC pointers?

2022-07-22 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/22/22 2:34 PM, Ben Jones wrote: Can you elaborate on why it's probably OK in practice? Because the GC deals with interior pointers just fine. Blocks with the "no interior" bit set are very rare, and for only specialized use, so normally this should not be a problem. I have argued in

Re: OK to do bit-packing with GC pointers?

2022-07-22 Thread Ben Jones via Digitalmars-d-learn
On Friday, 22 July 2022 at 16:57:21 UTC, Steven Schveighoffer wrote: It's specifically undefined behavior by the spec, but in practice, I think it will work, as long as the block you have isn't marked as not allowing interior pointers. See:

Re: OK to do bit-packing with GC pointers?

2022-07-22 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Jul 22, 2022 at 04:50:44PM +, Ben Jones via Digitalmars-d-learn wrote: > I'm looking to store a pointer to one of 2 unrelated (no inheritance > relationship) classes and use the LSb to track which type I have. Is > this going to cause any problems with the GC? For one of the classes

Re: OK to do bit-packing with GC pointers?

2022-07-22 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/22/22 12:50 PM, Ben Jones wrote: I'm looking to store a pointer to one of 2 unrelated (no inheritance relationship) classes and use the LSb to track which type I have.  Is this going to cause any problems with the GC? For one of the classes I'll have a "pointer" to 1 byte past the start

OK to do bit-packing with GC pointers?

2022-07-22 Thread Ben Jones via Digitalmars-d-learn
I'm looking to store a pointer to one of 2 unrelated (no inheritance relationship) classes and use the LSb to track which type I have. Is this going to cause any problems with the GC? For one of the classes I'll have a "pointer" to 1 byte past the start of the object. It seems like