Bevor I'd use C++ I'd take a hard look at Go, figure out whether I really need C++ performance, or whether Go is just good enough. Go is rather performant and in contrast to C++ memory safe.
If you say that C++ is not memory safe you really don't know the modern C++. Of course you can use only `void *` everywhere... but you can also write your software in a totally different way. My C++ code has no pointers, just objects, which are automatically destroyed when I want to. The nice feature is that I know when the destructor is called, so the object will clear itself in a very nice way.
Building a Website with C++
31–40 of 122 posts
Re: Building a Website with C++
#32Just use rust man :| why do you want to bring all your security vulnerabilities and undefined behaviors to web?
Rust would be equally unsuitable to this task. Web development in C++ or Rust? Why? There may be some advantages to writing a middle tier application server in either of these languages, but using a system language to manage a web front-end is effectively like using a hatchet to shave. Sure, the hatchet is faster at cutting wood than a safety razor, and if one is careful, it could be used to remove stubble, but chanc…
Re: Building a Website with C++
#33Re: Building a Website with C++
#34Re: Building a Website with C++
#35I'm in the early stages of a FaaS platform that uses CGI for the functions. As such, I have been collecting articles about general CGI development, and have them listed in my docs. If anyone is interested in writing large scale CGI apps (CGI is popping up a lot around here lately), these are some good resources: https://bigcgi.com/docs
Re: Building a Website with C++
#36Bevor I'd use C++ I'd take a hard look at Go, figure out whether I really need C++ performance, or whether Go is just good enough. Go is rather performant and in contrast to C++ memory safe.
If you say that C++ is not memory safe you really don't know the modern C++. Of course you can use only `void *` everywhere... but you can also write your software in a totally different way. My C++ code has no pointers, just objects, which are automatically destroyed when I want to. The nice feature is that I know when the destructor is called, so the object will clear itself in a very nice way.
Re: Building a Website with C++
#37I only saw one reason: performance. Did I miss some? Do people have other good use cases that justify paying the dev cost of using C++ for a web server? I'd guess with caching and a decent backend, it would be fairly hard to demonstrate a true need for performance that requires C++, but I'm sure there are a few demanding applications out there that need it.
Since a web page's throughput is usually network bottlenecked and not CPU bound, I'm curious (just for fun) what the max possible performance benefit of going C++ is, especially behind a CGI interface?
There's probably a small latency benefit at all times, and I'd guess there's a throughput benefit that is only visible if you're doing more than a few thousand requests per second..?
Re: Building a Website with C++
#38Re: Building a Website with C++
#39Re: Building a Website with C++
#40 cout \n";
...
cout \n";
FWIW I wrote an article about HTML escaping and shell here: http://www.oilshell.org/blog/2017/09/19.htmlFollowup: http://www.oilshell.org/blog/2017/09/29.html
Also if you want to use a native language for web sites (which I don't), Go is a better choice, as the standard library has html/template which protects you from naive injections: