lua-users home
lua-l archive

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


On Fri, Mar 29, 2013 at 01:33:18PM +0000, Rob Kendrick wrote:
> On Fri, Mar 29, 2013 at 01:15:12PM +0000, Gavin Wraith wrote:
> > I am having these error messages when I try to compile 
> > lpeg 0.11:
> > 
> > "c.lpcode", line 287: Error: assignment to 'const' object 'follow'
> > 
> > which I guess happens because my compiler does not allow assignments to types qualified as
> > const. Any suggestions how I get round this?
> 
> Hmm, time for a language lawyer.  At first glance, assigning to "const
> charset follow" seems file, because charset is a typedef for an array of
> chars.  What's changing is the the pointer, not what is pointed at, and
> that would be fine.  I assume you're using Norcroft?  It may be that it
> is not expanding the typedef at the correct time.

Further to this; I tried the following:

typedef unsigned char byte;
typedef byte Charset[123];

void test(const Charset follow)
{
	follow = NULL;
}

With Norcroft:
*cc -strict -c99 -fah -Wh -Otime SSEx4nim.c
Norcroft RISC OS ARM C vsn 5.69 [20 Oct 2010]
"c.SSEx4nim", line 7: Warning: extern 'test' not declared in header
"c.SSEx4nim", line 8: Error: assignment to 'const' object 'follow'
c.SSEx4nim: 1 warning, 1 error, 0 serious errors

With GCC, clang, and lcc, there is no error.  I think this is a bug in
Norcroft.

B.