lainchan / Ω

(untitled)

Jet Black · 2023-07-14 16:48
What is the best language and why is it C++? >created before you were born, will still exist long after you're dead >can do anything C can do plus a bunch of crap you can opt into or not >fast as hell, no runtime overhead (compile times suck however) >every attempt to replace/kill it has only made it stronger >truly free as in freedom (libc/g++ toolchain) >make awesome soykaf like games and spreadsheets I've used C++ to make (start) an RPG with SFML, a PHP extension (PHP5 only), and recently an audio tagging utility and every time it seems scary and bewildering at first but is almost like an adventure in programming and then very satisfying when at last I have a binary that does a thing. No other language has been such a rollercoaster of emotion or gives me confidence my code will still run in 5 years time.
Morpheus · 2023-07-14 21:05
>>71117 There are no truly good languages. I’ve grown to desire tools, not languages. Regardless, Common Lisp, Ada, APL, and perhaps a few languages I’ve yet to learn are the floor of what I’ll accept. The C and C++ languages are beneath me. >created before you were born, will still exist long after you're dead Every language I listed fits this description. >can do anything C can do plus a bunch of crap you can opt into or not Yes. Opting into buffer overflows is included. >fast as hell, no runtime overhead (compile times suck however) I’m not obsessed with overcomplicating everything in the pursuit of diminishing returns. A program must be correct above all things. >every attempt to replace/kill it has only made it stronger Many diseases fit this description also. >truly free as in freedom (libc/g++ toolchain) Every language I listed fits this description also. >make awesome soykaf like games and spreadsheets Both of those and more should be implemented at a high level in pursuit of correctness and maintenance.
Boris Grishenko · 2023-07-15 09:56
https://yosefk.com/c++fqa/ Educate yourself
Turner · 2023-07-16 13:27
>>71174 writing file parsers in it is absolute hell compared to other languages, primarily due to its lack of compile time reflection & templates make it very complicated to write generic code with for different types. Like in other languages i can just make a single generic function that takes any struct type, iterate over its members to read them and print it out for logging. No problem, i now have a struct that i can interact with in my program that just seamlessly transforms info the file format and back again when i want to. In fact i can even write multiple generic read / write functions for other formats like json or something like that, i dont even have to think about it. Just lookup if the required fields are in the passed struct, and if so serialize it according to the format specification. In c++ i have to define / declare the names of everything 3-4 times in various contexts (which can easily add up to like ~1000 lines of repeated code because there are so many different fields in certain file formats), i have to write a separate "read" & "write" function for each individual struct type in the file format, in which i have to repeat the same Stream.read() function call for each member variable (which again there are sometimes 100s of) it has. Talk about repeating yourself. Oh and dont you even DARE think about using the preprocessor to generate this because then people will call your code ugly as fuarrrk (which to be honest is true). The unironically recommended way to deal with this is to rely on your code editor to generate the 100s of repeating statements for you. Then you also have to deal with a bunch of template bullshit in order to make any sort of generic serialization for the entire thing because it will consist of multiple types in order to "fit" the format which you can usually only do with polymorphism which is slow or unions which waste space. Like i recently had to write a parser for JVM classfiles which needed a struct for Instructions with variable sized operands. I searched every other open source solution out there and they all fuarrrking used unions which means even a 1 byte instruction took up 8 bytes (as much as the largest instruction). I ended up doing a variadic template struct solution which had a tuple member variable of the variadic template argument but the problem is you can only access std::tuple elements via their type or a conexpr index value, but the interface obviously took a runtime index value, so i had to apply some retarded template bullshittery that called itself multiple times to figure out the appropriate type given a runtime value to access the tuple element, and it was ugly as fuarrrk and complicated. I guess thats why most c++ devs dont even bother to write file parsers that actually parse into real structs, instead taking the c approach and just reading into a buffer and provided a set of pointers and some functions for retrieving and modifying specific bytes in that buffer.
Trinity · 2023-07-17 01:43
Zig is what C and C++ wish to be. Well, it will be, once 1.0 releases.
Dozer · 2023-07-17 05:21
>>71175 C++ is created by an autist. its a joke, thats it. and its obvious to anyone with more than 5 iq. 3 iq people learn it to belittle people with 2 iq. thats all C++ ever was. >but brooooo it has all these new features in C++31 look it can do an haskal now yes, only a smart person would choose the more complicated way to do the same thing