help-bison
[Top][All Lists]
Advanced

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

Re: When to free RHS tokens?


From: John Levine
Subject: Re: When to free RHS tokens?
Date: 27 Dec 2016 15:06:26 -0000

>forvalues_cmd:
>FORVALUES IDENT "=" NUMBER "(" NUMBER ")" NUMBER "{" STRING_LITERAL "}"
>    {
>        // do I need to free() or del tokens $3, $5, $7, $9 and $11?

No.  Bison tokens live in an array, no allocation or deallocation needed.

If the lexer or parser puts a pointer to an allocated thing into a
typed token, you need to manage those things, but in the simplest case
where it's just an int, the int is in the array and there's nothing
for you to do.

R's,
John





reply via email to

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