Skip to content

Instantly share code, notes, and snippets.

@SeijiEmery
Last active January 5, 2017 00:27
Show Gist options
  • Save SeijiEmery/19e980e3f95b851147bc to your computer and use it in GitHub Desktop.
Save SeijiEmery/19e980e3f95b851147bc to your computer and use it in GitHub Desktop.
C++ preprocessor idea
Use/implement something similar to lzz (http://www.lazycplusplus.com/), but with some extensions.
Main ideas:
- only one (.lzz?) file, instead of split header (.h) / implementation (.cpp) files
- class methods and friend functions always written inline inside the class (much cleaner/more minimalistic)
- use IDE code folding to hide stuff...
- script autogenerates the .h and .cpp files for you
- build system:
- IDEs could be tricky, but getting something to work with cmake or makefiles would be pretty easy...
- Alternatively, could implement own build system that autodetects imported local files, and generates makefiles/whatever to process and include them.
- Would write something like 'import Foo/bar;', which would tell the build system to look for $PATH/Foo/bar.lzz, import the header, and to compile/link the .cpp/.obj file.
- Build files would be generated and maintained automatically – to compile foo.lzz, you could (hypothetically) just use magic_compile foo.lzz (with relevant flags, options to pass to clang/gcc, and libraries), and it would figure out all of the local dependencies based on the import statements (and separately compile those to .obj files, and link). Writing makefiles is such a PITA, when the compiler could automatically do this for you...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment