On Thu, Sep 13, 2001 at 10:06:51AM +0100, Philip Kendall wrote:
> If we are going to keep on doing fancy stuff with pointer arithmetic (eg
> the Alloc_Aligned/CHUNK_BASE stuff), I think we're also going to need an
> integer type which is guaranteed to be the same width as a pointer, so
> we can freely typecast between the two.

The language lawyer in me insists that I point out that this is
inherently nonportable.  C does not guarantee that it is possible to
convert losslessly between pointers and integers; there have been
systems on which this was impossible (or hugely inefficient) for
hardware reasons.

The correct approach to storing pointers and integerss in the same
value is to use a union.  Personally, I would use:

  typedef union {
      int   i;
      void *p;
  } IV;

I realize that I'm probably in a minority of one on this. :>


> Also, if we've got a system with 64 bit IVs, are the arguments to Parrot
> opcodes going to be 32 or 64 bit? If 32 bit, is there going to be any
> way of loading a 64 bit constant?

This reminds me of something I've been meaning to ask: Is Parrot byte
code intended to be network-portable?

                        - Damien

Reply via email to