[Mono-devel-list] Prevalence of pointer-integral-pointer casting in mono?

Jonathan Pryor jonpryor at vt.edu
Sun Aug 1 21:23:43 EDT 2004

On Sun, 2004-08-01 at 20:44, Peter Colson wrote:
> A general code question. Does the mono runtime make extensive use of the
> casting of pointers to integral types and then casting back to a
> pointer, expecting the pointer to be useable?

I'm not sure about Mono, but glib (one of Mono's dependencies) does
this.  It is generally assumed that a gint can be held in a gpointer.

> The reason I ask is that this has implications for portability. The C
> std, as far as I recall, does not guarantee that a pointer cast from an
> integral type will be useable. On platforms which have pointers that are
> larger than int or long this becomes a real concern.

I believe this is why C99 added int_ptr_t and uint_ptr_t.

 - Jon

More information about the Mono-devel-list mailing list