a) does anyone have a good comment stripper for c++? i tried google but none were what i was looking for (none handled comments within strings and the would that looked promising was in python and i want to be able to make an elf file for easy use.
b) does anyone have software that turns code i find like on the internet into a style that i choose? for example, i am looking at bjarne stroustrops calculator but it is in a style that makes it difficult for me to read.
c) what is loop unwinding and how does duffs device work?
d) i want to make a library full of functions and classes that i have made for ease of access, but i want to link to it at run time (ie $g++ foo.cpp -o bar -lmylibrary). i think i need to make a .a or .so file but idk how to do it (it will be for linux btw so no msvs tutorials on creating dlls please)
For a), why do you need a comment stripper anyway? Comments are meant to be useful, to make it easier to read.
For b), look into AStyle (Artistic Style), that sounds like what you want.
For c), loop unwinding is basically a technique that splits up loops into their component iterations, so as to make a program run faster, at the expense of having larger file sizes. I think you normally have to do this by hand, but some compilers will optimize this for you. I haven't heard of "duffs device", but that might be what it does.
c) Loop unwinding is causing a loop that will always iterate x times to simply execute x times instead of looping. This is faster because you don't have to test, increment, and initialize a counter. However, it can cause larger binary size and isn't faster in *all* cases, although I'm not aware of the special circumstances.
I also don't know what Duff's Device is...
d) Linking and run-time don't really go together. Are you wanting to use a library after your program has started? Please explain better.
i always do. i dont like to trust comments because they arent guaranteed what they do. and anything ill be reading right now wont be too bug. 200 lines or so. and at that size i just sit down and step through it with a piece of graph paper and kind of simulate executing it in my mind
You are building. That invokes the process of compiling and linking.
The linking stage starts after the compilation is done, so it's outside compile time.
There are three stages we can visibly see. Compile time wich compiles code into objects. Link time which links objects into a blob, figures out what symbols goes where, etc. Then run time which is what happens whenever your applications entry point is called.
There are two ways to link to a library at link-time.
One method is linking against a static library. This method makes a copy-similar of itself in your binary and code calls that section of your binary. This is advantageous for a few reasons. You don't have to worry about library versioning (well... you do each time you link against the library actually). You also don't have to worry about library location as its always in the binary.
The second method (and primary) is to link against a "stub" sort of library and have the linker figure it out on application start (pre-runtime). On the Linux platform, the "stub" is included inside of the shared library. and the linker figures everything out for you. On Windows, the stub and DLL are two seperate entities. It depends on platform and executable format but this method is preferred as you can update a library without the need to link stuff together again. It also allows for much smaller binaries and extreme reuse, especially whenever each program uses the same library over and over again.
Anyways, linking is easy enough. You can even link static and dynamic libraries into the same binary at the same time (depending on platform and executable format).
EDIT: Explain which one you might want, why you would want that method, and then I'll discuss how to go about it. :D
thanks. i figured out how to write .a files, so thats fine and it actually solved my question above, but when i finish my compiler i want to modulize it into .so files so that i can update different sections (ie patches) without having to have the user download the whole ELF file again