lua-users home
lua-l archive

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


On 28 March 2015 at 14:23, Luiz Henrique de Figueiredo
<lhf@tecgraf.puc-rio.br> wrote:
>> -->    rb = b + base;
>>
>> Should the line marked by arrow not be following?
>>
>>        rb = base + b
>
> In C, p+n and n+p are the same, even if p is a pointer and n is an int.
>

Right - I checked the C standard and it appears that for addition
either operand may be a pointer - but for subtraction left operand
must be a pointer.
Nevertheless this seems unnecessarily confusing - looking at 5.1
source I see that it was base+b.

Regards