[ragel-users] Is there a way to generate non-static variables?

Adrian Thurston thurs... at cs.queensu.ca
Fri Mar 28 19:02:23 UTC 2008


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.

-Adrian

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.
> 
> Thanks,
> Manoj
> 
> > 
> 



More information about the ragel-users mailing list