[Ecls-list] In LET/LET* bindings, the type of the form NIL is SYMBOL, not FIXNUM.

Matthew Mondor mm_lists at pulsar-zone.net
Tue Jun 15 22:47:02 UTC 2010


On Tue, 15 Jun 2010 23:03:06 +0200
Juan Jose Garcia-Ripoll <juanjose.garciaripoll at googlemail.com> wrote:

> On Sun, Jun 13, 2010 at 2:01 AM, Matthew Mondor <mm_lists at pulsar-zone.net>wrote:
> 
> > I am seeing this warning with HEAD ECL when compiling some code for
> > which I don't see how a value is unexpectedly NIL.  I'm wondering if
> > perhaps it could be a bug in the new compiler?
> >
> 
> This is simple to understand: you declared a variable A to have type FIXNUM
> but did not provide any intial value or, more precisely, according to ANSI,
> the initial value is NIL, as in
> 
> (let (a) (declare (fixnum a)) (setf a 0) ...)
> 
> That is valid but not really correct code and I am happy that ECL is
> figuring out that problem :-)

Thanks for the explanation, while I think I understand,
I also get this warning when using the following:

(defun test (a)
  (find #\a a))

And noticed that the part of my code where two instances this warning
were issued used FIND as well:

(defun (setf address-address) (address-string address)
  "Permits to bind a new address to ADDRESS.  Several address families
are supported; If the address contains a '/', assume AF_LOCAL.
If it contains ':', assume AF_INET6.  Otherwise, assume AF_INET.
A condition of type UNIX-ERROR will be signaled on error."
  (check-type address address)
  (check-type address-string string)
  (with-c-constants (:errno :sys-socket)
    (let* ((family (cond ((find #\/ address-string)	; <- 1
                          AF-LOCAL)
                         ((find #\: address-string)	; <- 2
                          AF-INET6)
                         (t AF-INET)))
           (ret (c-inline2 ((address-pointer address) address-string family)
                           (:pointer-void :cstring :int)
                           :int
                           "
{
        usockaddr_t     *a = (usockaddr_t *)#0;
        char            *str = #1;
        int             family = #2;
        int             ret = 1;

        *(USOCKADDR_FAMILY(a)) = family;
        a->ss_len = USOCKADDR_SOCKLEN(a);
        if (family == AF_LOCAL)
                strncpy(USOCKADDR_ADDRESS(a), str, 100);
        else
                ret = inet_pton(family, str, USOCKADDR_ADDRESS(a));

        @(return) = ret;
}" :one-liner nil)))
      (case ret
        (1 t)
        (0 (unix-error "(setf address-address)"
                       EADDRNOTAVAIL
                       `(,address ,address-string)))
        (otherwise (unix-error "(setf address-address)"
                               (errno)
                               `(,address ,address-string)))))))

Thanks,
-- 
Matt




More information about the ecl-devel mailing list