Reminder that C is simply inappropriate for writing performant code. Not only does C make it difficult and tedious to write efficient code efficiently but it even lacks a lot of the facilities to make it possible. C cannot monomorphise code based on type or value parameters at compile time or specialize parts of code based on type traits. C cannot create efficient abstractions that allow you to naturally and easily write efficient code. And in fact C makes it so difficult that most C programmers simply do not bother with it (considering the alternative is repeating the code for each possible case) and prefer to use less efficient solutions like void pointers and runtime metadata which erases valuable compile time information that the compiler could've used to optimize. C lacks the ability to design general interfaces with automatically specialized implementations at compile time causing C programmers to prefer shittier, less efficient, less powerful, less maintainable and less elegant interfaces. This extends to all the other zero-overhead abstractions that C potentially could have but lacks, causing C programmers to fall back to inferior solutions.
C is not good for writing efficient software. C is not good for writing well designed software. C cannot into efficient abstractions. C is not good for high level application development. C is not even good for low level systems programming or embedded anymore, and is continually being proven inferior in that field. C is not good for anything. There is no field that C excels at over other programming languages, there is always a language better and faster than it, and most of the time that language is C++ as it addresses every issue I've brought up so far. The difference between C and C++ is that C allows you to write highly efficient code in theory, while C++ allows you to write highly efficient code in practice.
tl;dr if you're looking to write fast code, C is the wrong language.
i sort of agree, in that writing C that attempts to adhere to OOP abstractions is tedious and stupid. i think you are not seeing the use case for embedded systems in which things like virtual function tables and raii are usually not possible.
Ryder Carter
>embedded systems in which things like virtual function tables and raii are usually not possible. Of course they are. They may not be appropriate, at least virtual methods, but they definitely just werk. And there's nothing unappropriate about RAII in embedded. RAII is literally just automatically inserting destructor calls for you instead of you inserting them yourself.
Asher Torres
OOP abstractions are tedious and stupid.
Gavin Lewis
but user, why does the destructor automatically get called? because the object is on the stack. embedded systems generally don't have large enough stacks to accommodate large programs that make use of raii. some microcontrollers i've worked with can't into function tables either
Ethan Richardson
Why are you assuming the program is large? RAII is fine for small programs too. Check out this video. He writes a game in C++17 for the commodore 64. youtube.com/watch?v=zBkNBP00wJE
Kayden Ward
B-b-but memory safety!!
Jason Morris
while i watch this boring video can you post more anime girls with nice thigh creases
If you keep calling everyone who likes cartoon pictures of obviously developed girls pedos, being one will soon be considered entirely normal. You're normalizing pedophilia.
Kevin Williams
ok i watched the entire video on 1.25x speed and i have a few thoughts. one: i have to say i agree with your premise for the most part. c is still faster in benchmarks but it takes much longer to develop. two: using intelligent planning with c code (i.e. not forcing oop or doing retarded state piles) can still be an effective strategy for those who don't want to put all the super optimizing effort in like he did. three: you have impeccable taste in 2d harlots. much respect user, even if you were trying to bait people
Ayden Martin
You don’t just write C programs. You write them also for the Unix command line obeying POSIX standards and interfaces. These days microcontrollers are running Unix with soft real-time so there’s no need to whine about the size of the hardware.
Ayden Rodriguez
elementary school
Isaiah Moore
not into underage, post something similar to OP
Lucas Richardson
>three: you have impeccable taste in 2d harlots. Thanks! >can still be an effective strategy for those who don't want to put all the super optimizing effort in like he did. The optimizations he did are far easier to achieve in C++ than it is in C, and he didn't have to put a lot of time into "intelligent planning" either. That doesn't mean you can just not think about it, that's dumb, but you don't have to spend extra time planning purely to work around or fit C's limitations. I think that's objectively a good thing.
The philosophy of piping programs together is outdated and more importantly inefficient as your programs waste of a lot of time copying data around (twice), parsing text, and doing context switches. The unix philosophy is bad in that way. It is better to apply the unix philosophy to libraries instead, and enable LTO. The core utilities are still useful for small things and should be kept, but anything less trivial than that is better not done by piping a bunch of processes together.
Piping is great for automation. Why would I write a whole new program to automate a simple task when I can write a one line bash script instead?
Ryan Robinson
Yeah when you write C you write against 1970's teletype devices.
Levi Hall
>The core utilities are still useful for small things and should be kept, but anything less trivial than that is better not done by piping a bunch of processes together.
Data structures are usually more important than algorithms for performance on modern computers. C gives a lot of control over how data is stored in memory.
Isaiah Hall
>unix philosophy how is cs101 going?
Grayson Morris
expose the program as a library and automate it using a programming language, like how python is used to script c and cpp libraries. Too many languages? Program and script in the same language by using a self-hosting language. Need IPC? Don't separate related programs into separate address spaces and let programs share functions, data structures, classes and methods. Welcome to Symbolics Genera.
Juan Cruz
So does C++. You're not forced to use the standard containers, but they're there for 90% of cases.
Xavier Lee
All of the useful parts of C are compatible with C++. It's much easier to express data structures correctly and safely in C++ than C because you can control memory automatically and overload operators to work on your data structures.
Christopher Morgan
You seem to misunderstand. I'm not saying the unix philosophy is good. I'm saying if you really want to apply it, it's better to apply it to libraries, not whole programs.
C is good because it prevents people from doing stupid things like operator overloading, and inheritance, which only make the program harder to understand.
Joseph Flores
cute Lisa
Charles Thomas
>anything less trivial than that is better not done by piping a bunch of processes together No thanks, I would rather keep the flexibility/simplicity. If you want something done fast avoid ipc shit.
Asher Bailey
C is bad because it allows people to do stupid things like buffer overflows, and null dereferences, which only make the program unstable and insecure.
Samuel Reyes
>buffer overflows, and null dereferences learn to code
Asher Morris
>operator overloading, and inheritance, which only make the program harder to understand. Maybe for low IQ retards. Inheritance is shit most of the time, don't get me wrong. It all comes down to using these things correctly. C++ is not a language that is friendly towards retards, nor should it be. You have to know what you're doing just as much as you do in C. Operator overloading when used correctly can greatly improve the readability of source code. Same with (virtual) inheritance, when used where it makes most sense. Example, overloading operator[] for containers. Overloading all the arithmetic operators for arithmetic types such as complex numbers and vectors. Overloading the dereference operators for smart pointers. Using virtual inheritance for drivers (used a ton in kernels). You just need to know when to use them, and when not to use them. Which usually isn't much of a problem for anyone who isn't a retard.
>If you want something done fast avoid ipc shit. That's basically what I'm saying. Piping a bunch of programs together is bad for performance. If you don't give a shit about performance then sure, go ahead. May as well use Python or some other equally trash language while you're at it too.
>Not only does C make it difficult and tedious to write efficient code efficiently but it even lacks a lot of the facilities to make it possible. This literally translates to "I'm a shitty programmer and someone else didn't make the stuff that I need but can't make myself" C is the most efficient language for the stuff that it is used and in theory is still the most efficient for everything if one has the time to write for months what other languages would do for weeks, even though the C alternative will surely be faster and hardware efficient. Efficient code is not something that good programmers have to tryhard to achieve. And all these "facilities" are not inbuilt but can easily be made with C, usually in a much more efficient way than their premade counterparts into other languages. The only downside to them in C is that they are strictly meant to be used in the particular program in most cases. It's kinda lame for people who don't know C, nor they need C in their programming, to give their opinion. Just go back to javascript and let the big boys work.
Henry Hall
Undefined behaviour allows the compiler to do better optimizations without wasting cycles checking for bad code. Operator overflowing just makes code more ambiguous. The proper way to do abstractions is with functions.
Jayden Campbell
>C is the most efficient language for the stuff that it is used and in theory is still the most efficient for everything if one has the time to write for months what other languages would do for weeks Yes, in theory. >even though the C alternative will surely be faster and hardware efficient Not if you use an actually good language. C++ allows you to achieve the same performance and control of C in less of the time.
>Operator overloading just makes code more ambiguous. The proper way to do abstractions is with functions. The only way this could be true is if you're unfamiliar with the operators, or it's done badly. As I said, operator overloading done correctly makes a lot of sense. I'd much rather see container[i] and a * u + v instead of container.at(i) and u.prod(a).add(v)
Hudson Richardson
WHY IS THIS THREAD NOT CLOSED YET
Nathaniel Brown
Why would it be
Tyler Long
>May as well use Python or some other equally trash language There is no reason you can't have simple fast programs + a bloated scripting language linking them together to aid in usability. Why are you such a retarded extremist? Why is it so hard for you to understand that there are different tools for different jobs?
Brody Lopez
actual discussion on Jow Forums and not mindless consumerism? you have to close it immediately
Jaxson Rodriguez
The only reason you'd need a bloated scripting language to link them together is if your other language was complete trash and had no support for efficient abstractions. Not to mention you're also wasting time and cycles making the bindings for it.
>The only reason Nope, I don't want to waste time on development which is why your oop shit exists in the first place. Why the fuck do you think python + numpy is so popular?
Henry Johnson
>I don't want to waste time on development That's why you use an actually good language that allows you to achieve the performance of C with less of the effort and time. >your oop shit huh?
Connor Martinez
scantily clad women an a work-safe board
Luis Butler
Can you guys not respect the work-safe aspect of this board or something? Why post this anime crap?
Jayden Sanchez
There's nothing NSFW in this thread.
Justin Walker
You're joking right? Anime girls in bikinis with cameltoes and tits hanging out is without a doubt NSFW. If a coworker walks by my work area and glances at my monitor those pics will be the first thing they see and my job is jeopardized.
How is this difficult to understand?
Benjamin Perry
how about not using Jow Forums at work idiot
Brody Ramirez
Are you retarded? There are SFW and NSFW boards on Jow Forums. Jow Forums is a SFW board. Stop posting this crap.
Do you not have a job? Do you not understand thow this works?
Jaxon Garcia
There are no true SFW boards on Jow Forums. If you think you can browse the front page of Jow Forums at work you're retarded. You're retarded for browsing Jow Forums at work to begin with.
Levi Baker
The thing about IPC is that it's just not a problem for single address space systems. You can just give a different program a pointer to some data, or a function, class definition or whatever have you. An IPC model of single-direction octet streams as the only means of communication is obviously shit.
C is only the 'most efficient' language because its prevalence limits what can be done with conventional hardware. No C standard allows for a programmer or a compiler to manually weight branch prediction, for example.
Undefined behavior is what's behind most security faults in software. Not to mention that these issues are often introduced by compilers, meaning that to move the responsibility for secure code to the programmer means adding practically full understanding of the compiler to his responsibilites as well. also in reasonable languages operators aren't different from functions. Maybe they have special syntax.
Ethan Sanchez
I do have a job. Generally they frown on using the work network for personal use. I actually got Jow Forums blocked at my university VPN, too, for "questionable" content
Jonathan Bennett
>unironically browsing sites like Jow Forums while at work You deserve to be fired.
Levi Mitchell
You've never had a job in your life. You wouldn't be saying this otherwise.
I'm not a programmer by trade but I have to sit in an office with other people sometimes. I'd like to browse Jow Forums but can't because of autists that need to post anime porn on SFW boards.
John Morales
>The thing about IPC is that it's just not a problem for single address space systems. You can just give a different program a pointer to some data, or a function, class definition or whatever have you. Sure, if you can do that go ahead. It's not too different from using threads anyway.
Aiden Hall
I already saw this thread, but I still agree with it. However, let's not pretend that C++ is "good". It's bad, but (at least since C++11) it's less bad than C.
Why do people visit Jow Forums and complain about anime? I'll never understand it. There's much worse NSFW shit being posted than clothed anime girls
Samuel Morris
Jow Forums doesn't use the same definition of NSFW as you. If it did all boards would be red. Fuck off and actually do your job.
James Cook
>calls others autists >rather browses Jow Forums than socialize with his coworkers
Nathaniel Cooper
I teach at a high school in China. No socializing, and you fucking virgin autists have to post these pictures for some reason.
William Taylor
>The philosophy of piping programs together is outdated and more importantly inefficient as your programs waste of a lot of time copying data around (twice), parsing text, and doing context switches. The unix philosophy is bad in that way. Finally someone who points this out. You just have to use Emacs for a while to realize how exposing functions instead, and reusing the code directly, is a much better form of code reuse for scripts and automation. That's what Lisp machines did.
Isaac Taylor
> being this retarded > doesn't understand the / represents OR > C OR C++ how did you manage to end up this fucking retarded?
Owen Ward
see:
Landon Hill
it brings shame, gore at least makes you look edgy
>Efficient code is not something that good programmers have to tryhard to achieve. Anyone who believes this has never written anything where performance really is important, nor anything with more than one thread of execution. Writing truly fast, efficient code is hard no matter the language. And purely functional languages actually make writing heavily parallel code easier.
Oliver Russell
Yeah I'd rather my boss saw an anime girl then gore or scat which does get regularly posted on Jow Forums so what the fuck are you doing visiting this place at work
Justin Sullivan
To get you fired obviously.
Andrew Richardson
on Jow Forums? Where?
Caleb Wilson
Gore and scat is more sane (and legal) than pedoshit.