Closed elfring closed 10 years ago
Thanks. As you will have noticed, this code is far from usable, but you are right about the async things. Since the code is in such an early state, and the signal handling isn't something that will stay, I didn't bother doing it right™. The "puts" function obviously doesn't belong there, as it may allocate and a signal may be raised in an out of memory situation. "exit" calls atexit handlers that may allocate. I fixed the issues here.
Thanks for this source code improvement.
I suggest to consider another implementation detail. How do you think about the aspect if "should_terminate" needs also to be a static variable?
It can be. The should_terminate variable was supposed to be used from outside the signal handling code to give other code control over its behaviour. Since yaccpp code doesn't actually do this, and the signal handling is going to be different in the release version, I'll make it static.
I am curious how this software will evolve further ...
I'm not sure.. I'm not using C++ for compiler construction, these days, so this project is mostly on-hold. I'm disappointed in Bison's GLR performance (it's basically unusable for highly ambiguous (sub-)grammars). YaccPP might be useful in Aldor, but we use an ancient "zacc" tool (also a yacc preprocessor) for that, and it's working fine.
I guess that a different program design will be needed for your function "throw_signal".