More on type sizes

Richard Kenner kenner@vlsi1.ultra.nyu.edu
Wed Dec 29 17:03:00 GMT 1999


    Chill doesn't generate ARRAY_REF for bit arrays/string.  Instead, it
    generates PACKED_ARRAY_REF, which is defined in ch/ch-tree.def.

Hmm... I don't much like the idea of making a type in the
language-independent code which only language-specific code can
handle.  My feeling is that if the only things which can process a
type are language-specific, then the type should be as well.

Also, why is a function call used in ch/expr.c?  Isn't it easy enough
to open-code the one-bit case?

    I mentioned before, but this may be the right time to do so again: The
    macro TYPE_MAX_VALUE is mis-designed, because it does not work well
    for empty ranges.  It would be better to use TYPE_MIN_VALUE having the
    value of the appropriate type, and replace TYPE_MAX_VALUE by a new
    macro called something like TYPE_RANGE_SIZE.

    The invariant is that all instances of TYPE_MAX_VALUE(x)
    would be replaced by the sum of TYPE_MIN_VALUE and TYPE_RANGE_SIZE.
    However, while the type of TYPE_MAX_VALUE is that of the range type
    (except in the case of empty ranges!), the type of TYPE_RANGE_SIZE
    is the appropriate size type.

I don't follow here.  Please define "empty range" and give me an example.

For Ada, when either bound is variable, TYPE_MAX_VALUE is a MAX_EXPR to
handle the empty cases (you can have arrays with bounds 0 .. -100 in Ada
and it is *not* the same as an array with bounds of 0 ... -99, though both
have the same size, 0 bytes).


More information about the Gcc mailing list