misc fixes for C++ generation

- fix one case of constant generation
- don't generate static constants for literals
- clean up generated code