[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: file.png (13 KB, 213x236)
13 KB PNG
It's 2026 why is C still being used?
>>
>>108914664
everything is written in it
>>
>>108914664
Because it's just barely good enough and as bad as it still is, every single shitlang invented since is objectively worse.
>>
Gotta go fast.
>>
>>108914664
C sucks but every other language sucks worse and/or requires some bloatware "runtime" and/or doesn't compile to machine code
>>
>>108914676
Lisp is better
>>
>>108914664
C is memory safe
https://desuarchive.org/g/thread/108770946
>>
>>108914693
Lisp can get recursively collected because it's garbage.
>>
>>108914676
>Because it's just barely good enough and as bad as it still is
>>108914685
>C sucks but
You're probably also insufficient in x86 ASM, and think no one needs to know assembler or microcode.

People like you will always be replaceable so perhaps we should let you whine on the interwebs while you can.
>>
File: curl-vulnerabilities.png (207 KB, 2494x1404)
207 KB PNG
>>108914664
Because mature projects with a modest scope and employing good engineering practices won't see any benefit at all from switching.
>>
>>108914705
>You're probably also insufficient in x86 ASM, and think no one needs to know assembler
Where did this retarded idea come from
I think C sucks because it enforces null terminated strings, because retarded compiler devs (except MSVC) think that "undefined behavior" means "let's delete your code to make it faster", and the syntax for pointer dereferencing is fucking retarded and should just be the same as ASM syntax i.e. instead of *Pointer you'd do [Pointer] to dereference.
Also, the fact that incrementing a pointer also multiplies the increment by the sizeof the pointee is dumb and makes it annoying to work with variable-sized data structures.
Less related to the language itself, but I also think the entire C standard library is poorly designed trash that should never be used. But (at least with MSVC, dunno about other compilers) it's very easy to simply not link with the standard library.
>>
>>108914664
Because C has become the lingua-franca of computing. Every other language is a second class citizen, all library's and interfaces have to speak in C.
>>
>>108914766
Oh yeah and the lack of operators to support bitwise rotate (could've just used <<< and >>>)
>>
>>108914664
Because you can do pretty much anything with it. All those extra features in other languages are just that, extra. I don't need it, I'll just use C. Fast compile time and relatively performant compared to running something like the Java runtime or whatever... Yeah, I don't see a reason to use anything else. Rust looks cool too, but honestly. I don't see a compelling enough reason to switch.
>>
>>108914664
Because it's simple and gives you a lot of control. I'm not a defender of memory-unsafety, but sometimes that kind of open-ended control is desirable. Plus it's a language that has stayed true to its philosophy of simplicity over the years.
The real question is, why is C++ still being used?
>>
>>108914809
Dude you are just repeating propaganda. There is no such thing as memory unsafety. It's literally all just 0s and 1s and that's all it's ever been. Everything else is dogmatic ideology.
>>
>>108914869
>dogmatic ideology
No. It's willingly imposed restrictions on memory operations that boost software stability and ease of collaboration while eliminating common pitfalls.
>>
>>108914809
>The real question is, why is C++ still being used?
Because it's really powerful and lets you write whatever you want with great performance, and no other language offers that.
>>
>>108914766
write your own string lib
>>
>>108914927
oh just shut up, herb
>>
>>108914934
That is not the issue. Designing your own string representation and writing a library for it is easy. The problem is the language itself mandates null-terminated strings when you write a string literal. There is no way to prevent null-termination of such a string.
C provides for prefix characters to be placed in front of string literals to modify them in some way, e.g. L"Unicode string". They should add another character such as R (for raw) so you could do R"non-null terminated string".
>>
>>108914934
You still need to use C-strings when interfacing with the base language itself or with any other C library.
>>
>>108914957
you need fprintf, snprintf, and a can-do attitude
>>
>>108914941
ok but it's true though
>>
>>108914664
it werks and doesnt get in my way
>>
File: say_it.jpg (49 KB, 1280x720)
49 KB JPG
>>108915061
say zero cost abstraction one more time
>>
>>108914664
Because it works, and you have a better shot at finding people to maintain your code down the road than if you wrote it in the trendy language of the year.
>>
>>108914664
Anything that is as efficient as C has to be as shit as C.
>>
>>108914664
A C compiler isn't as much a C compiler as it is an "ideal" minimal front end to the layers of IR that eventually feed the DFAs that optimally schedule instructions. The reason assembly doesn't beat C in year of our lord two thousand twenty-six is because ya gotta feed the multi-issue, out of order, register renaming, speculatively executing, micro-op powered, resource partitioned, execution units, and C is the stablest, simplest language that can be traced backwards and forwards by humans to and from C source. If you can't get C going, you have exactly zero hope with anything else.
>>
>>108914693
Lisp is older (and worse)
>>
>>108914664
Because it's better than whatever shitlang (you) are pushing. C pradates and will outlast every other language the industry invents
>>
>>108914766
Takes 2 seconds to write a struct that also stores the length of a null-terminated string. Wow was that so hard? This is a must when e.g. parsing large text buffers anyway to avoid copying strings.
>let's delete your code to make it faster
Go write your own compiler then and report back. All the mainstream compilers do extremely clever tricks to make life easier for devs so we don't have to worry about boring details when writing code. It's already difficult enough to follow any spec to the letter, so assuming some kinds of UB won't happen is a necessity for them. Modern compilers are already too complex as is.

>the fact that incrementing a pointer also multiplies the increment by the sizeof the pointee is dumb
No, you're dumb. That is the correct syntax that covers a very common usage pattern. Cast the pointer or just use a different pointer type to begin with. BTW, misaligned pointers are UB.

>the entire C standard library is poorly designed trash that should never be used
Cute. Too bad nearly every piece of software in existence either directly or indirectly uses it. Every OS and program is deeply entangled with some sort of C standard at this point, so it's never allowed to change or break. It's not fair to judge the shitty standard library when it was not allowed to change for decades.

Yes there are minor new libc features in newer spec versions but not much. They can't be too drastic because they have to be similar to the old shitty APIs.
>>
>>108914789
this, i tried using some other languages, but then you suddenly depend on bindings, which have to be actively maintained (they frequently aren't), also their APIs can be very opinionated and underdocumented compared to the source C library.
The only exception i make is for GUI libraries like FLTK or Qt that are natively written in C++. But even then I tend to write only the GUI portion in C++ and everything else in C and link those together.
>>108914957
even kernel syscalls expect C-strings.
I just learned not to bother with any string libraries at all, just pass the fucking C-string, if you need it's size, just call strlen once and pass it's length along too, how hard is that?
String libraries do have some nice properties when you look at them at first, like no-copy string slices, but what's the point if in the end you still have to copy them to make them null-terminated to interface with the kernel, standard library, or any common C library?
>>
>>108914664
No serious alternative.
>>
>>108914705
>You're probably also insufficient in x86 ASM
You're "insufficient" in English.
>>
>>108914927
>can't split a string
>>
>>108916620
>BTW, misaligned pointers are UB
anyone who still blabs about undefined behavior in 2026 is a literal retard
signed integer overflow, misaligned pointers, and null pointer dereference are not undefined if you program for Windows using MSVC.
>b-but its not LE PORTABLE
not my problem if some Lintroon has trouble running my code (which wouldn't work on Linux anyway unless maybe they use Wine).
>>
>>108916899
Stop breathing through your mouth.
>>
>>108916902
you're just mad that i'm right
dont worry I'd be mad too if I used a compiler that deletes my code for no reason kek
>>
>>108914664
os creators still concatenate c compiler binary as the first thing they do once their os boots, you cannot concatinate C# or Html binary instead
>>
>>108916950
Use a better model.
>>
>>108914949
You can probably write a helper function or macro that does this for you that gets optimized out by the compiler.

But that's pointless. All of that just to save *a single* byte of memory. The bigger issue is that many APIs you have to interface with may only support null-terminated strings.

Just store the extra byte, it's a non-issue.
>>
Its the easiest to read and write and it doesnโ€™t pretend you are retarded
>>
>>108916857
>The only exception i make is for GUI libraries like FLTK or Qt that are natively written in C++. But even then I tend to write only the GUI portion in C++ and everything else in C and link those together.
Same, this is still the sanest, most well-defined but most importantly stable approach still to current day.
>>
it looks nice
>>
When are the devs going to update C to remove header files
Just make it like JavaScript (my favorite language) and hoist the declarations above so we can just have a .c file
>>
>>108918963
>Just make it like JavaScript (my favorite language)
You don't say
>>
>>108914664
let me guess, you need more?
>>
>>108914917
You are just repeating propaganda, plain and simple.
>>
>>108914664
It's 2026 why is DNA still being used?
>>
>>108914664
jobs and legacy code
odin is better in every way
>>
hey, op, here's little message 4 u

#include <stdio.h>
#include <time.h>

#define I 8
#define C 79
#define YOU ",RMSS[`-"
#define FAG(x) ((struct timespec){0,((x)*1e5)})

int main(){int o=0,l=0,i;for(;C;o=(o+1)%I, i=nanosleep(&FAG(666),0))
for(i=0;i<=C;++i)putchar(i==C?'\n':YOU[(i+(C/2+1>l++%C?o:I-o))%I]-0xC);}



don't stare at it... run it!
>>
I learned C a long time ago, but haven't used it since. If you're used to other languages, wouldn't all the warts be irritating? Sure, things like syscalls are easy, as are memory manipulation and data structure inspection. But you also have many irritations, like the janky #include system, and lose out on modern time-saving conveniences such as higher-level (or run-time) pattern matching in place of switch statements, or richer typing (distinct from "object orientation").
>>
>>108914664
decades of support and robust tooling

>>108922775
this, suitable for embedded and low-level environments. then you can choose something quicker to work with
>>
File: ghjffghj.png (9 KB, 817x349)
9 KB PNG
>>108914664
>It's 2026 why is C still being used?
it memory safe
https://desuarchive.org/g/thread/108770946
>>
>>108914664
Zig hasn't released 1.0 yet
>>
File: IMG_9502_421.png (189 KB, 640x1136)
189 KB PNG
9front.org

better question is why is anything else used?
>>
>>108922775
skill issue
>>
>>108922893

exactly

bro probly doesn't eevn use skip lists
>>
9front.org sheeeittt let the system do the heavy lift
>>
>>108914664
C feels like building a sculpture out of modeling clay. It's very malleable and easy to change if you structure your program incorrectly. Rust is like using stone and a chisel. Once minute you are creating a masterpiece and then the fucking thing cracks in half and you have to start over.
>>
https://volatco.tech/
>>
>samefagging central
i left this thread alone to see when it will be pointed out that C is actually NOT (newly) used in 2026 for the most part
but instead, we got 10s of samefagging messages accepting the premise in some retarded attempt at baiting to some unknown end lol
>>
>>108923331
neat. see you tomorrow.
>>
>>108914685
C, by definition, requires a runtime though.
>>
>>108924738
You can easily just not link with the runtime and not call any C standard library functions. It's easy to do that on Windows because the win32 API does everything you need it to do.
On Linux? Lol no you can't do anything without libc. Unless you happen to have Wine installed :^)
>>
>>108924775
Win32 is a runtime.
>>
>>108914664
C is the Latin of programming languages.
>>
>>108924833
Win32 is not a language specific runtime like I meant in my original post. It is just an API which lets you use operating system features.
By runtime I meant something language specific, such as the C library or C++ library or whatever bloatware that Rust use that makes a hello world 3MB.
>>
>>108914664
It is 2026, why aren't your writting your program in your favorite trendy slop language, then asking LLM to translate it into C?
>>
>>108924860
That's entirely besides the point. The C standard library is just a buch of functions and types, which provide no more overhead than you'd get of you wrote them by hand in your program. You still don't depend on a VM or similar.
>>
>>108924997
That is not really true at all. Every compiler includes a bunch of random calls to functions in its own C library. For example gcc depends on libgcc. You have to jump through a lot of hoops to make it stop using libgcc.
With MSVC it's pretty easy to turn it off but you still have to change build settings.
>>
>>108914664
its compatible with everything under the sun and everything is made to run on it
if you are a making a general purpose library, C is most times the best option
>>
>>108914693
Sorry, it isn't.
It might do a lambda function call better but it cannot perform many advanced programming functions.
>>
The correct thing to do is to do a performance comparisson with extensive testing of the language functions then to implement the improved variant.

Afterwards we're left with the best of all worlds all in 1 C++.
>>
>>108914664
>Why aren't you using my troon lang ? it's better...
Rust troon developer question. It's not. C just works and if you stop caring about counting genders you might be able to take care of memory.
>>
>>108914664
Because rust lost
>>
>>108914664
Look at this board? Can't you tell? People are retarded.

Also AI is yet to come up with the 'perfect' language, that will not have its flaws exposed for centuries.
>>
>>108914664
https://files.catbox.moe/shc4rh.mp4
>>
>>108916620
Yes writing your own string struct every time you want one is very annoying. Like many C issues of course you can work around it, but it's still a complete waste of mental energy that could have been spent on something better in a language with real strings.
>>
>>108918963
Never, fuck off. Header files give you almost self-documenting APIs and extremely efficient compilation.

If you want degenerate syntax and slow compile times you can use Zig or Rust instead.
>>
>>108914664
portability
instead of writing programs for each architecture coding it in c allows you to compile the same code across multiple architectures
>>
File: herbs.jpg (77 KB, 648x1052)
77 KB JPG
>>108914941
how did you know it was me?
>>
>>108924775
No you can't. MSVC still generates code that calls CRT required features, like memset and shit. You'll just get a linker failure when doing freestanding instead. You don't know what you're talking about.
>>
File: 1754743381096855.jpg (9 KB, 250x241)
9 KB JPG
>>108914941
>herb
Guess again...
>>
>>108914676
So don't use the shitlangs then, next question.
>>
>>108920679
that's pretty neath but you're just showcasing your math knowledge instead of programming power, now do something useful, cnile
>>
>>108925993
scott is outstanding communicator. he gives very level headed takes. examples and counter examples. scope is limited. sure he has goofy hair but i like what he does, or at least did. didnt he bounce once herb took over and started expanding the standard to retarded levels?
>>
>>108926566
nigga, i don't have to do useful shit. I like having fun. there is a plethora of useful software in C for showcase. the very foundations of your computer experience stand on C code whether you like it or not
>>
File: 1769263235870.jpg (6 KB, 150x150)
6 KB JPG
>>108927141
>netflix - java
>google - java
>amazon - java
>facebook - php
>firefox - c++/rust
>chrome c++/rust
>windows c++/rust

what software that's useful is written in C?
>>
>>108927236
This. Basically any nontrivial software that isn't from SysV era is basically C++ or something else. C is basically FOSS and basic throwaway toy shit. Also it isn't 2006 anymore. GCC's C++ implementation is pretty good now. I really don't understand this C meme. Rust and C++ both completely btfo C so thoroughly it isn't even funny.
>>
>>108914664
it's 2036, why are you still here making this thread?
>>
>>108927236
>>netflix - java
>>amazon - java
>>facebook - php
>>netflix - java
>useful
>>
>>108927236
>>108927268
holy shit, niggers. you are a fucking morons. i didn't and won't enumerate massive C codebases that support your current digital life, because fuck you dishonest ignorant niggers, please kindly: do us a favor and kill yourself NOW
>>
>>108927350
there literally isnt many if any useful consumer software that's written in C, everything is js/python/c++/rust/java/c#/swift/go
>>
>>108927350
Anything you can enumerate is likely already 20% C++ already or not that important. It's very rare I see any pure C in anything I work with. I won't say it doesn't exist, but it's stinky shit no one wants to touch in fear of nasal demons.
>b-but muh UNIX clone #468383
Any retard can do one, but it ultimately comes down to wanting to waste time reimplementing drivers.
>>
File: UNIX and C.png (351 KB, 1676x2690)
351 KB PNG
>>108914664
Cargo cult.
>>
>>108914664
seethe more, rustroon, and know that your favorite language is hated because of you, personally
>>
>>108927510
>It's very rare I see any pure C in anything I work with.
It varies massively by area, and know so little about how other application domains really work. People even write major stuff in Python. Hell, they even do that in goddamn Excel and that's plain cursed.
>>
>>108927459
All of these depend on libraries written in C.
>python
Python is just a wrapper for C libraries.
>>
>>108928738
>C provided muh freedoms
Why do retards say this? Maybe when C compilers were a fucking joke and people were still using macro assemblers because otherwise performance was abmysall. You still need to uphold virtually the same invariants Rust and C++ ultimately require anyway. I wish this fake history would die.
>>
>>108922872
The only real answer
>>
>>108929091
>>108925147
>>108925152
How does rust live rent free in your heads?
>>
>>108925100
Such as?
>>
i think the better question would be why use C over C++ (without using all of its features of course because fuck modern sepples)
>>
>>108925986
>MSVC still generates code that calls CRT required features, like memset and shit. You'll just get a linker failure when doing freestanding instead. You don't know what you're talking about.
no it doesnt
i have a ~70k lines of c code project which is compiled with msvc and none of it is linked to the C-runtime
>>
>>108929797
>msvc
not memory save, use tcc.exe instead
https://desuarchive.org/g/thread/108770946
>>
File: 1692184474579066.gif (106 KB, 600x600)
106 KB GIF
>>108914664
i love C
it's the only language that never leaks out of my brain
it's such a simple and powerful language
haters just hate they are too stupid to use it effectively because all they can do is copy and paste code that has already been written for them
>>
>>108930694
my only issue with it is macros, which can become pretty hard to read
>>
File: pepe.gif (16 KB, 498x498)
16 KB GIF
>>108914664
Mature code >>> tranny ass shit >>> jeeted microslop
>>
>>108930667
>tcc
is a garbage non-optimizing compiler
>>
>>108931218
finish (You)r project 1st, then start optimize, retard
>>
>>108916899
>if you program for Windows using MSVC.
which is like 0.1% of C users
>>
>>108924775
>. It's easy to do that on Windows because the win32 API does everything you need it to do.
>On Linux? Lol no you can't do anything without libc.
what difference does it make whether the runtime is hidden from your toddler ass or gets linked explicitly (but automatically, if you use any normal compiler)? the program still needs a process data structure to be set up for it to run

just because you're a retard who hasn't even tried doing anything on a non-windows platform doesn't mean there's a practical difference. the C runtime needs to be set up even on bare metal microcontrollers for anything to work
>>
File: Annotation 2026-05-01.png (11 KB, 569x145)
11 KB PNG
>>108931578
https://pixel<cut>drain.com/u/QAmX4mm5
>>
File: dfssdfdfsEN.png (7 KB, 434x119)
7 KB PNG
>>108931578
>>
>>108931578
you're just mad that some faggots at Microjeet managed to design a better OS API than your unix gods Ritchie and Kernigger
>>
>>108931613
>>108931607
what are you trying to say here, nigger? win32 provides a runtime because that's literally what the C standard requires
>>
>>108925986
Its not a big deal having to provide your own implementation of memset. I think the compiler requiring a handful of helper functions still qualifies as free standing.
>>
>>108914710
The thing is that all the problems have been discussed ad nauseam. The undefined behaviours, the weird types, and the mallocs and the frees. It's complex and error prone but no longer a mystery.
>>
>>108925252
Headers give an additional liberty that oop languages don't have as they direct you towards interfaces and late time binding.
>>
>>108927350
Freedom of speech means slavery to the idiot masses
>>
>>108932052
>standard
runtime is optional
>>
>>108929621
>faster compile times
>better tooling, especially debuggers
>better language stability
>not having to deal with sepples programmers

>inb4 just use c-style c++
It's a term that doesn't mean anything and combines the worst of both worlds. If you're gonna write C++ as if it were C, you miss out on the 2% of actually useful C++ features while missing out on everything I listed (and more).

>inb4 just don't use the features you don't like bro
Not possible. In C++, unlike many other languages, language features are often mutually dependent (e.g. constructors and exceptions). You'd be correct if the language were actually modular, but it just isn't the case.

>inb4 c++ is a superset of c
Everyone knows it isn't, in the strict mathematical sense, but it's also true in terms of idioms and features: all non-ancient C codebases nowadays make heavy use of out-of-order designated initializers, an extremely useful feature introduced in C99 which, to this day, C++ lacks. The memory model is also arguably better and simpler to reason about.

Last, but not least, much of the C functionality present in C++ interacts quite poorly with the rest of the language, therefore one might wonder why it's present to begin with.
>>
>>108930821
Macros can get ugly, but I'd much rather use them over C++ templates.

Let's face it: 99% of the things templates are actually used for, in practice, is type-generic containers. Macros, while less ergonomic, can provide this functionality. Plus, while there are some things that templates do which macros can't, the opposite is also true. Since preprocessor macros are just plain text substitution, they are not limited to being a function or a class. You can use to introduce many kinds of syntactic sugar, many real world codebases do this without trouble.

The notion that preprocessor macros are evil and should always be avoided is nothing but a meme from StackOverflow and the like. Unless you deliberately go out of your way to make your life harder, macros can do far more good than harm.
>>
>>108925046
>That is not really true at all. Every compiler includes a bunch of random calls to functions in its own C library. For example gcc depends on libgcc
This proves the opposite of the point you were trying to make.
>>
>>108931218
tcc is extremely fast, hence very useful during development. It can even run C code on the fly as if it were a script. I set up my own C repl with it, it's not at all a difficult thing to do.

I find it bizarre how so many people don't leverage multiple implementations of the language they are working with for different purposes.
>>
>>108932997
tcc cannot even compile my codebase because it doesn't support the numerous MS extensions that I use
it can't even compile many freetard codebases because they use GCC or Clang extensions
only a few libraries for which "portability" is a design goal can actually be compiled with tcc
I wonder if tcc could even handle Windows.h and all of the sub-headers it includes, because they probably have MS extensions in them as well
A C REPL that runs inside a debugger sounds really cool though, it's definitely on my bucket list of things to do because it means I can experiment with poking values into memory and calling random undocumented APIs to see what happens without having to recompile and re-run my program
>>
File: Annotation 2026-04-18.png (19 KB, 514x349)
19 KB PNG
>>108932997
>tcc
https://desuarchive.org/g/thread/108770946
>>
>>108924847
Latin is more of a FORTRAN desu
>>
>>108927236
Just off the top of my head
curl
Postgresql
Nginx
Apache httpd
Openssh
Haproxy
Tmux
Python (CPython)
Lua
Raylib
Redis
>>
>>108927510
It just means you just work on enterprise GUI bloatware or maybe gaymes and not real problems.
>>
>>108914664
because every other language gets in your way, even other versions of c past c89
>>
>>108914664
Java mogs
>>
>>108933045
>A C REPL that runs inside a debugger sounds really cool though
GDB can sort-of already do this.
>>
>>108914693
lisp vs haskell, which is better?

both have the lambda as their logo
>>
>>108936982
>lambda
pointer on a function
>>
>>108936987
let me rephrase my question.
for a newb, if i was to learn either haskell or lisp, which is better to learn (in the long run)?
>>
>>108936993
lisp is useful because of emacs, no one uses haskell
>>
>>108937122
>emacs
punch cars simulator
>>
>>108936993
Do you want to achieve satori or become the weird guy who jerks himself off with emacs?
>>
>>108914693
Lisp would be better with a static type system and compile type macro evaluation.
>>
>>108936993
Lisp is far less complicated and easier to learn and use.
>>
>>108936993
haskell, because in the long run you will need types. But in the actual long run if you are serious about software you will use c.
>>
>>108929797
Literally bullshit. I've had to write basic implementations for shit, LIKE MEMSET, using intrinsics like __stosb when I explicitly do "freestanding" builds on MSVC

Fuck off you lying faggot.
>>
>>108938289
never been a problem for me
anyway, __stosb and __movsb are based as fuck, imagine filling up your instruction cache with useless loop-unrolled "optimized" memset's when all you're doing is zeroing out a 30-byte struct
>>
>>108914667
fpbp



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.