Why are void contents marked as having pointers?
SeeWebsiteForEmail at erdani.org
Sun May 31 15:49:54 PDT 2009
Vladimir Panteleev wrote:
> On Sun, 31 May 2009 23:24:09 +0300, Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> wrote:
>> But I think this is too much ado about nothing - you're avoiding the type system to start with, so use ubyte, insert a cast, and call it a day.
> I don't get it - not using casts is avoiding the type system? :P Note that I am NOT up-casting the void later back to some other type - it goes out to the network, a file, etc. void sounds like it fits perfectly in the type hierarchy for "just a bunch of bytes", except for the "may contain pointers" fine print.
>> If you have too many casts, the problem is most likely elsewhere so that argument I'm not buying.
> I could cut down on the number of casts if I were to replace most array appending operations to calls to a function that takes a void and then internally casts to an ubyte and appends that somewhere. There's a lot of diversity of types being worked with in my case - strings, various structs, more raw data, etc. I'm more annoyed that I'd need to do something like that to work around a design decision that may not have been fully thought out.
More information about the Digitalmars-d