[ragel-users] Re: Is there a way to generate non-static variables?
ma... at nanorex.com
Fri Mar 28 19:07:24 UTC 2008
In that case would it be too bad to provide a constructor kind of
function which the developer must explicitly call? But this way we'd be
simply be moving data-space reclaimed (?) to instruction space to encode
these initializations in addition to storing the immediates so this
might not be a great idea :-)
Adrian Thurston wrote:
> If the variables were not static they would need to be initialized from
> static variables. So short of loading the data from a file you can't
> avoid the static data.
> Manoj Rajagopalan wrote:
>> Hi Adrian,
>> In C/C++, the variables generated are static. While I can write data
>> for different machine instantiations in different functions, the
>> static-ness makes the data allocated persistent. Instead, if there were
>> an optional way of disabling this which could be used inside functions
>> allocation would be on the function's stack and the total data segment
>> size for the program would remain modest.
>> I am in the process of writing a unit test suite where I have one
>> master Ragel file and am including parts of it for non-invasive testing
>> in my test-suite CPP files. I have to perform a write data for each line
>> that I am testing and then for more complicated machines that build on
>> lines tested in these simpler tests.
>> These tests are part of a potentially enormous test suite for a heavy
>> application with many components. I suspect statically-allocated global
>> data requirements can become quite large though I haven't faced any
>> problems yet. Please correct me if I am wrong.
>> If this idea is worthy of exploration then Ragel could provide a
>> 'nostatic' option to the 'write data' statement which we developers
>> would use in some scope inside which we'd like the data to be
>> exclusively visible.
More information about the ragel-users