bug-mailutils
[Top][All Lists]
Advanced

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

[bug-mailutils] getitem() - "list.c:395: error: assignment of read-only


From: Joachim Nilsson
Subject: [bug-mailutils] getitem() - "list.c:395: error: assignment of read-only location"
Date: Sun, 04 Jul 2004 19:36:18 +0200

Hi!

This is just FYI.  In mailbox/list.c:391 from CVS (see underlined
sections in snippet below) there's a compile error using GCC 3.3.4
(Debian Sarge) saying:

gcc -DHAVE_CONFIG_H -DLOCALEDIR=\"/usr/local/share/locale\" -I. \
    -I../../mailbox -I.. -I../../include -I../../mailbox \
    -I../../mailbox/include -I../include/mailutils/gnu \
    -DSYSCONFDIR=\"/usr/local/etc\" \
    -DSITE_VIRTUAL_PWDDIR=\"/usr/local/etc/domain\" -g -O2 -MT \
    list.lo -MD -MP -MF .deps/list.Tpo -c ../../mailbox/list.c \
    -fPIC -DPIC -o .libs/list.o
../../mailbox/list.c: In function `getitem':
../../mailbox/list.c:395: error: assignment of read-only location
make[4]: *** [list.lo] Error 1

Here's the code snippet:
-----------------------------------------------------------------
static int
getitem (void *owner, void * const *pret)
                                    ~~~~~
{
  struct list_iterator *itr = owner;
  *pret = itr->cur->item;
  ~~~~~
  return 0;
}
-----------------------------------------------------------------
I changed the declaration to void **pret and it worked a lot better.
Seems my GCC doesn't like the "void * const *ptr" construct and,
frankly, I've never seen it be used like that before.  However, my
gcc-fu in this area is weak and you guys now why it's there so you
probably have a better fix.

Regards
 /Jocke

-- 
Joachim Nilsson :: <joachim AT vmlinux DOT org> 
+46(0)21-123348 :: <http://vmlinux.org/joachim/>





reply via email to

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