Crow – C++ Microframework for Web, inspired by Python Flask
61–65 of 65 posts
Re: Crow – C++ Microframework for Web, inspired by Python Flask
#62The way your routes work mean that a response is expected to be immediately generated and returned. It would be much nicer if a response object was passed to the callback and you could return immediately from the callback, but send a response independently, when you are ready. Kind of like this: CROW_ROUTE(app, "/about") ([](Response res){ res.send("About Crow example"); }); Why you might ask? So you can do this: CRO…
Re: Crow – C++ Microframework for Web, inspired by Python Flask
#63Earlier quoted context omitted.
> because all the code becomes inline. The language says that's just a suggestion to the compiler, right? Does any compiler actually inline for non-trivial methods?
`inline` has a different meaning in C++. The compiler is free to inline the call if it wishes to, but `inline` means that the same function can be defined in multiple translation units without breaking the one definition rule. Example: // header.hpp inline int f(int x) { return x + 1; } // a.cpp #include "header.hpp" // b.cpp #include "header.hpp" If f was not marked inline, linking a.cpp and b.cpp together would fin…
Re: Crow – C++ Microframework for Web, inspired by Python Flask
#64Earlier quoted context omitted.
How do you justify mass recompilations for every minor version bump or bugfix to your users?
This is only a problem if the user structured their code horribly. The library handles HTTP requests, it should be on the edge of the architecture. Side note: C++ is fantastic in this regard because it makes you suffer every time for excessive coupling. The compile/link times act as a recognizable metric that devs have an interest in minimizing, and the process of doing so produces better code. I love that it is ruth…
Even then you will be rebuilding and redeploying the edge of your architecture every time this library gets a minor minor version number bump.
I would choose not to have to do that, every time.
Re: Crow – C++ Microframework for Web, inspired by Python Flask
#65Earlier quoted context omitted.
`inline` indicates to the compiler: "this function has external linkage, and no matter how many times it's defined it is to be defined only once in the final linked output". It's the same as if there was no inline, but when the linker finds multiple definitions of the same function it is allowed to ignore them instead of failing. It also serves as a inlining hint to the compiler in its free time. Note that you don't…
'static' is old. It must have meant something to Kernighan and Ritchie. I see no connection to the word inline in the C++ meaning. In C, at least, inline means inline. My guess is that the C++ inline got its meaning from the winding path of c++ history, and only makes sense in the context of that history.