[Openmcl-devel] Type declaration question

Gary Byers gb at clozure.com
Mon May 25 19:20:30 PDT 2009


"(DECLARE (TYPE (UNSIGNED-BYTE 64) FOO))" says that FOO is of type 
(UNSIGNED-BYTE 64) within the scope of that declaration.

In some cases, the TYPE declaration specifier can be omitted;
"(DECLARE (FIXNUM FOO)) is shorthand for "(DECLARE (TYPE FIXNUM FOO)".
The spec may be a little unclear about which cases allow this shorthand;
section 3.3.2 describes a declaration as being something whose CAR
is a "declaration identifier", and the glossary defines a "declaration
identifier" to be one of a predefined set of symbols or a symbol which
specifies a type; it doesn't seem to allow compound type specifiers
(like (UNSIGNED-BYTE 64)) to be used as declaration identifiers, though
other passages in the spec suggest that they should be allowed here.
(See <http://trac.clozure.com/openmcl/ticket/465>).

I don't think that CCL has ever allowed compound type specifiers to
be used as declaration identifiers.  Prior to some changes that Gail
made in the trunk a few weeks ago, it tended to quietly ignore declarations
that it couldn't make sense of (and that would include cases where 
a compound type specifier was being used as shorthand for a TYPE declaration);
a warning is now signaled in that case.

On Tue, 26 May 2009, Sudhir Shenoy wrote:

> Can anyone tell me what the proper declaration for a 64 bit unsigned
> integer is? I was using "(declare ((unsigned-byte 64) foo))" which I
> am fairly sure worked prior to CCL 1.3 but now I get a compilation
> warning and the fasl is not generated. I checked the CLHS and there
> doesn't seem to be an upper bound on the number of bits in the
> unsigned-byte declaration.
>
> I have this in some low level i/o conversion (reading in a IEEE float
> value of 8 bytes and converting to a Lisp number) code where I use
> (ldb (byte 1 63) foo) to extract the sign-bit, for example. Is there a
> better way to do this?
>
> Thanks
> Sudhir
>
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>
>



More information about the Openmcl-devel mailing list