[M3devel] BITSIZE on constants?
Rodney M. Bates
rodney_bates at lcwb.coop
Thu Dec 20 18:16:32 CET 2012
On 12/19/2012 11:08 PM, Jay wrote:
> Eh? isn't bitsize(type) valid? It is in C and seems confroversy-free.
BITSIZE(type) (and BYTESIZE and ADRSIZE) is indeed valid on a _type_ in
Modula-3. At the last paragraph of 2.6.13, it is defined as the size of a
_variable_ of that type. The whole idea is that a compiler should not be
obligated to store a constant in memory.
Presumably, you know statically what the type of a CONST is, so can't you
just use BITSIZE(TypeOfConst)? If you later changed the constant
to a different type, it wouldn't self-adapt, but likely other places wouldn't
either, or maybe would, but not correctly for your program.
>
> - Jay (briefly/pocket-sized-computer-aka-phone)
>
> On Dec 19, 2012, at 8:44 PM, Antony Hosking <hosking at cs.purdue.edu <mailto:hosking at cs.purdue.edu>> wrote:
>
>> Constants don’t occupy any storage. So they have no size.
>>
>>
>> On Dec 20, 2012, at 3:31 PM, Jay K <<mailto:jay.krell at cornell.edu>jay.krell at cornell.edu <mailto:jay.krell at cornell.edu>> wrote:
>>
>>> Why isn't BITSIZE valid on constants? Only on variables? Or types?
>>>
>>> - Jay
>>>
>>>
>>
More information about the M3devel
mailing list