Earlier quoted context omitted.
From memory, a thing i've implemented in C++ that its basically impossible in almost any other languages (with few exceptions). Represent a data table in memory where the columns are from different types, where the data is backed by a arena allocator and represented contiguously in memory. Of course you can do a data table representation in almost any language, but once you benchmark the implementations, the language…
Sounds like Rust should handle this case just fine?
Does C++ still deserve a bad rap?
251–260 of 310 posts
Re: Does C++ still deserve a bad rap?
#252Earlier quoted context omitted.
Is there any language where string handling doesn't suck? (No script languages please, because they cheat by implementing the hard things on C or C++) From memory the less horrible experience i had was with Go, but there's help for the slices on the runtime which let the difficult parts hidden and also the batteries-included std library, which is one of the most well designed standard libraries out there. Buffer mana…
C# and Python... "a, b".Split(", ") // C# "a, b".split(", ") # Python
"a, b".split(", ")Re: Does C++ still deserve a bad rap?
#253Earlier quoted context omitted.
To be fair, C++'s standard I/O library is really bad. There is probably an almost universal consensus in the C++ world that the locale library is the worst standard library, immediately followed by iostreams. For small programs that's annoying, although using libc IO is usually fine for them. However, C++ is probably one of the top 3 languages for developing large applications (Java would also be there, not sure whic…
In terms of large projects C++’s role is very much shrinking. C++’s last major strength is being cross platform, but new platforms keep excluding it. You can’t program on iOS or client side websites with it. Microsoft actively discourages using C++ on Windows, and C# took over for large projects. Essentially C++ and the modern ideas about computer security are at war.
https://docs.microsoft.com/en-us/windows/apps/winui/winui3/x...
Re: Does C++ still deserve a bad rap?
#254Like every programming language out there, C++ is a tool. And like every tool out there it has its uses. There isn't any point of using C++ to count words in a text file. Any high-level language like Python will beat you to it. However, there's one thing you can do in C++ and not in Python or JavaScript or PHP: fully control the memory layout of your data. While you don't need it in most of the cases, it becomes a ki…
import mmap # Unix, Windows
with open('c_structs.bin', 'rb') as file, mmap.mmap(file.fileno(), 0, access=mmap.ACCESS_COPY)) as buf:
result = (YourStruct * 3).from_buffer(buf) # without copying
https://stackoverflow.com/questions/17244488/reading-struct-...Re: Does C++ still deserve a bad rap?
#255I still love C++ but rarely code in it any more. One interesting thing is that the whole modern approach to immutable data structures seems so wasteful to me now. C++ you literally take strings and overwrite characters, where now people duplicate lists of records just to stay clean. Once you have the discipline you need in C++ to make mutable data structures work its a hugely efficient place to be. However I sleep mu…
When you're dealing with UTF-8, you can't overwrite your buffer in the general case because changing case can change the encoded length of the characters.
Re: Does C++ still deserve a bad rap?
#256As someone who writes <5 commits of C++ per year, it is very frustrating. I can’t get through a code review without reviewers referencing at least 2 blog posts about proper style for modern C++. I’m sure if I were an expert who used it every day I could remember all the gotchas and best practices, but it sure is tedious to deal with occasionally. Too many foot guns and conventions, not enough constraints in the langu…
Re: Does C++ still deserve a bad rap?
#257My beef with C++ is with its dependency (non)management. For almost every modern language, you can easily build and run code - pull code from repo, run the included script or standard command to get the dependencies and build it, bam, you're done without needing to know much about that language. With C++ it seems like half of the time pulling someone else's old project from github and running make (or whatever the au…
Re: Does C++ still deserve a bad rap?
#258Earlier quoted context omitted.
To be fair, C++'s standard I/O library is really bad. There is probably an almost universal consensus in the C++ world that the locale library is the worst standard library, immediately followed by iostreams. For small programs that's annoying, although using libc IO is usually fine for them. However, C++ is probably one of the top 3 languages for developing large applications (Java would also be there, not sure whic…
In terms of large projects C++’s role is very much shrinking. C++’s last major strength is being cross platform, but new platforms keep excluding it. You can’t program on iOS or client side websites with it. Microsoft actively discourages using C++ on Windows, and C# took over for large projects. Essentially C++ and the modern ideas about computer security are at war.
I've seen Rust being used for the layer above C++, where it doesn't have to deal with I/O, scheduling, etc that don't play well with Rust but you still want the throughput/latency and memory safety.
Re: Does C++ still deserve a bad rap?
#259Re: Does C++ still deserve a bad rap?
#260I don't think C++ ever really had a bad rap except among ideologues and evangelists of other languages. In my experience, people like this are very rare in the real world outside of maybe Rust conferences.
Equally, a lot of people just don't know any different. How would you know C++ isn't optimal if you've never tried or thought about anything else. That and the sunk-cost of learning C++ is large.