help-bison
[Top][All Lists]
Advanced

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

Re: set_goto_map() has unintentional ++ operator


From: Sean Nakasone
Subject: Re: set_goto_map() has unintentional ++ operator
Date: Mon, 29 Dec 2014 16:29:13 -1000

oops!  you're right.  sorry for the trouble. 

Sent from my iPhone

> On Dec 29, 2014, at 12:06 PM, Hans Aberg <address@hidden> wrote:
> 
> 
>>> On 29 Dec 2014, at 22:40, sean nakasone <address@hidden> wrote:
>> 
>> The placement of the ++ makes it a post increment, so it's incremented after 
>> the statement, so it should not affect the value of k.
>> 
>> It's incrementing values in temp_map, but temp_map is deallocated after the 
>> for loop, so that's why I thought it wasn't doing anything.
>> 
>> for (s = 0; s < nstates; ++s)
>>   {
>>     transitions *sp = states[s]->transitions;
>>     int i;
>>     for (i = sp->num - 1; i >= 0 && TRANSITION_IS_GOTO (sp, i); --i)
>>       {
>>         goto_number k = temp_map[TRANSITION_SYMBOL (sp, i) - ntokens]++;
>>         from_state[k] = s;
>>         to_state[k] = sp->states[i]->number;
>>       }
>>   }
>> 
>> free (temp_map);
> 
> It loops through the inner loop several times though, so the next time, the 
> value has changed.
> 
> 
> 
> _______________________________________________
> address@hidden https://lists.gnu.org/mailman/listinfo/help-bison



reply via email to

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