guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: The relationship between SCM and scm_t_bits.


From: Paul Jarc
Subject: Re: The relationship between SCM and scm_t_bits.
Date: Mon, 17 May 2004 16:17:10 -0400
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (gnu/linux)

Marius Vollmer <address@hidden> wrote:
> I don't think you can store into one member and then (portably)
> assume anything about the value read from a different member.  This
> is very much like storing into one memory location thru one pointer
> and reading that same location through a differently-typed pointer.

True in general, although some cases are legal.  Any type can be
accessed as an array of unsigned char; two structure types with a
common initial sequence of members can have those members accessed;
the first element of a structure, or any element of a union, can be
accessed directly through the element type instead of explicitly as a
member of the structure or union.

So, for example, if SCM is simply a struct containing scm_t_bits, then
you can access that scm_t_bits value without the SCM wrapping, and
given a union of scm_t_bits and SCM, you can access the scm_t_bits
member, even if the SCM member was the last one assigned to.


paul




reply via email to

[Prev in Thread] Current Thread [Next in Thread]