The C Programming Language

The C Programming Language

Attached: thecprogramminglanguage.jpg (379x499, 27K)

It's a good language, but structs can't have overloaded operators. Makes it a little harder to do large scale numerical computation.

What would be the alternative to structs then?

R has the same problem, but it's still a champ

lmao, my boomer coworkers with 20 years of embedded C experience still overflow their buffers once in a while.
it's depressing.

well classes are garbage, you shouldnt mix data and methods like that. Just let us do operator overloading.
struct F = { int a,b;}
F __binary_operator_plus (F f1, F f2){
struct ret;
ret.a = f1.a + f2.a;
ret.b = f1.b + f2.b;
return ret;
}

references would not a bad idea either, its annoying to type &F every time to give a function a pointer. It really should allow shit like func(S &s)

I'm in the early stages of a C project. I've got a pretty good grasp on the language, but this is my first large-scale endeavor.
Here's my question: Should I modularize my code into separate files where the data for each module are static variables in the files? Or am I still thinking with my OOP brain?
I'm just concerned with the though of having fifty thousand declarations in my main file and getting lost in the late stages.

Attached: Cosimo Galluzzi.png (1091x1200, 537K)

>The C Programming Language
The C Programming Language

a lot of people will split their code into different directories based on logical function, and then further split it into different files within those directories
for example, writing a game, rendering code could be several files in a /project/gfx/ directory while network code goes into /project/net/

right, I guess I'm asking if there are no downsides to this pattern, especially in terms of performance.

not really, just gotta be careful how you link everything and what you tell the compiler to do
makefiles are gods gift to programmers

yea, I'm using makefiles.
>careful how you link everything
anything in specific here? I mean if it compiles it's fine, right? Or are there good and bad ways of linking things?

no, just mean that the more complicated you project structure the more difficult it is to link everything together in a way that doesnt shit out compiler errors
if you get beyond that stage you are fine

You could write a macro to do this for you. I know people retch violently when you say it, but macros are useful for this kind of stuff.

How do I get hash tables in this language?

functions exist
operator overloading is ugly

Makefiles are trash
>making a separate build directory is nearly impossible
>dynamically generating dependency files based on compiler's output is nearly impossible
>atomic builds of separate files needs to be implemented manually
>no awareness of compilation dependencies of variables
>impossible to make the incremental build actually correct
>even more crippled bash syntax to the point of uselessness
POSIX makefiles are worthless, GNU makefiles are usable but mess

redo > make

Use a hash table library.

I'd still like more opinions on this if you have them

Attached: retro space travel.jpg (2800x1825, 793K)

C is the best!
Beats the rest!

A really great book that allows you to learn c or refresh your knowledge of it, in a way that focuses on coding rather than concepts

Attached: 51Be8EsowoL._SX408_BO1,204,203,200_.jpg (410x500, 43K)

god tier bait

use a library brainlet

I want to squart in Dennis Ritchies mouth.

Remember to hide, report, and downvote any post that calls a language "unsafe"

#include


void ascii_func(char *str) {
while (*str != '\0') {
printf("%d\t%c\n", *str, *str);
str++;
}
}


int main() {

char *scan = "poo and pee";

ascii_func(scan);
}

Based

The C Programming Language

>The C programming language
>fucking 2019
>Rust exists

It's time to forget this primitive and outdated pile of trash.

flustercuck of symbols and abbreviations. It makes me angry just looking at that awful code.
C literally cannot be replaced. It's flawless.

The C Programming Language?!

>C literally cannot be replaced. It's flawless.
No generics. No atomics. Shit-tier type system. No standard toolchain. printf. pthread. No closures. No iterators. No standard container library. Null-terminated strings.