Bill Allombert on Fri, 31 Aug 2012 19:31:32 +0200


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

Re: In-place update of matrix row causes lvalue error in gp2c


On Fri, Aug 24, 2012 at 11:17:26AM +0200, Dirk Laurie wrote:
> When gp2c compiles the following GP code:
> 
>         X[1,] += [10,20]
> 
> the corresponding line of C generated is:
> 
>         rowcopy(X, 1) = gadd(rowcopy(X, 1), p2);
> 
> This causes the error message
> 
>         error: lvalue required as left operand of assignment
> 
> The problem can be worked around by changing that line to
> 
>         X[1,] = X[1,] + [10,20]

Hello Dirk,
This is a documented limitation of GP2C in the BUGS file:

  Things that are not implemented:
  --- a[b,]+=c
  --- issquare([4],&a[b,])
  
Cheers,
Bill.