[Haskell-cafe] Storable types with zero size
Carter Schonwald
carter.schonwald at gmail.com
Sat Dec 19 20:04:10 UTC 2015
Ohhhh. I see. I guess the funny bit is that the size of a strictly
evaluated unit type should be zero. So size zero is what I was thinking
about.
On Saturday, December 19, 2015, Douglas McClean <douglas.mcclean at gmail.com>
wrote:
> My thinking was that an address p is valid for a type a iff p `mod`
> (alignment (undefined :: a)) == 0 and that, at least in most languages, x
> mod 0 is undefined. In contrast, anything mod 1 is 0.
> On Dec 19, 2015 10:01 AM, "Carter Schonwald" <carter.schonwald at gmail.com
> <javascript:_e(%7B%7D,'cvml','carter.schonwald at gmail.com');>> wrote:
>
>> 1 byte alignment might be tricky.
>>
>> When talking about storable, its helpful to keep in mind that it's meant
>> to facilitate c interop, and ask what the corresponds with unit in c land,
>> and I think the answer is 0 bits :)
>>
>>
>>
>> On Friday, December 18, 2015, Douglas McClean <douglas.mcclean at gmail.com
>> <javascript:_e(%7B%7D,'cvml','douglas.mcclean at gmail.com');>> wrote:
>>
>>> Can the sizeOf a Storable type be 0?
>>>
>>> As far as I can see the documentation doesn't say. I wouldn't expect
>>> there to be a problem, but there also isn't an instance Storable (), which
>>> I was expecting to see.
>>>
>>> If so, should its alignment be 1 or 0?
>>>
>>>
>>> -Doug McClean
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20151219/405ab579/attachment.html>
More information about the Haskell-Cafe
mailing list