[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip / qa] [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

Name
Options
Comment
Verification
4chan Pass users can bypass this verification. [Learn More] [Login]
File
  • Please read the Rules and FAQ before posting.
  • You may highlight syntax and preserve whitespace by using [code] tags.

08/21/20New boards added: /vrpg/, /vmg/, /vst/ and /vm/
05/04/17New trial board added: /bant/ - International/Random
10/04/16New board for 4chan Pass users: /vip/ - Very Important Posts
[Hide] [Show All]


New anti-spam measures have been applied to all boards.

Please see the Frequently Asked Questions page for details.

[Advertise on 4chan]


File: hmmm.jpg (116 KB, 936x631)
116 KB
116 KB JPG
Welcome to the Daily Programming Thread. What are you working on, /g/?

previous thread:
>>103007187
>>
I just want to make video games
>>
File: primer_malloc_3.png (701 KB, 1920x9950)
701 KB
701 KB PNG
It's got good engagement.
https://lainsafe.kalli.st/files/17301866764995.txt
>>
>>103025252
https://archive.is/3J2gv
>>
>>103025283
I can't wait for that to go belly-up like the internet archive.
>>
>>103025204
I just want to reverse engineer existing ones and emulate consoles for playing them.
>>
>>103025292
yeah, it's the first time I'm using another site than webarchive, since the page saving service is not available right now. it's very grim
>>
>>103025292
have they explained anywhere a plausible motive for the attack?
doesn't make any fucking sense
>>
Listen up, brain-dead C coders, I'm sick of seeing your trash code polluting the internet. Newsflash: C is a relic of the past, and if you're still writing new code in that antiquated language, you're a joke.

Rust is where it's at, folks! It's the only language worth using for real programming. All this nonsense about "C being a great learning language" or "it's good enough for small projects" is just that – nonsense. You think you're "learning" C? Ha! You're just perpetuating mediocrity.

Look at all these ancient, crusty C projects out there. They're like fossils from the stone age of programming. All that manual memory management and pointer arithmetic? Give me a break. It's like trying to solve a rubix cube with your feet while being attacked by swarm of bees.

Rust, on the other hand, is the future. It's the language that actually cares about your sanity (and your security). Memory safety? Check. Concurrency? Check. Compile-time evaluation? CHECK. You can't even write a race condition in Rust without the compiler yelling at you.

And don't even get me started on C++ – that abomination is just C with added complexity and more ways to shoot yourself in the foot.

So, I'm calling it: all your C programs need to be rewritten in Rust. Yes, all of them. From scratch. It's time to retire those dusty old `#include` statements and hello there, `cargo.toml`.

Don't bother responding with "but I have legacy code" or "it works fine for my project." I don't care about your petty excuses. You're just clinging to the past like a relic.

Rust is the new C (get it?). It's the only way forward, and if you're not on board, then get out of the programming profession altogether.

**RUST IS THE ONLY LANGUAGE WORTH WRITING CODE IN**

---

**Edit:** I know some of you are thinking "but what about this Rust feature or that?" Listen, if you can't even bother to learn the basics of Rust, then maybe programming isn't for you.
>>
File: dumb.webm (3.03 MB, 1280x674)
3.03 MB
3.03 MB WEBM
>>103025159
dumb test of my elm-like desktop gui framework for F#
>>
>>103025319
>doesn't make any fucking sense
who would have any gain in deleting knowledge and history?
it's the kind of question that would never even be asked in the medias because no fake story is going to get convincing: big bad russians, "nihilist" hackers
>>
>>103025333
the nsa hates this new way of communication
>>
>>103025365
kek
>>
>>103025364
right, the most obvious conspiracy theory is that it's government(s) who are deleting shit
but then why go to the trouble of hobbling the site?
they could have quietly deleted stuff without anybody even noticing
but by attacking and DDOSing everything, the site gets locked down and they can presumably restore from backups
so that doesn't make much sense either
so whether from mainstream media or alternative/conspiracy viewpoints, I haven't yet heard any suggestions of what specifically is being targeted there
did they piss somebody off in a public way prior to all this?
were any certain groups or governments trying publicly to get them to remove certain materials?
>>
What kind of tricks do text editors use for performance? When you're scrolling through a chinese document I doubt it's rasterizing thousands of vectorized characters every update. I'm guessing they cache characters into like a bitmap font in the correct font/size/etc... as they're used, but I don't really notice any delay on a decent editor even when first opening a document?
>>
>>103025457
Yeah it's caching, that's what I did in my engine.
>>
>>103025457
>chinese
aren't most of those characters made up of like a relatively small number of common components just arranged in different configurations?
>>
>>103025569
I know fonts aren't as simple as 1 codepoint = 1 glpyh or whatever, but I don't know if they really bothered with all of the effort for that CJK characters.
>>
>>103025569
no, they're each a separate bitmap/vector image.
>>
meow is such a great keybinding scheme.

I wish there were a good text editor that supports it.
>>
>>103025457
An uncompressed 4k texture (4096x4096) is ~90mb in vram. At 16x16 pixels per character you could render 65,536 characters onto a single 4k texture. That's over 6 times what you need for every Chinese character in common use. The first time you use a character, render them onto your cache texture, use a hashtable or something to map each character to an offset in that texture, then write a shader to copy from that into your backbuffer as necessary. There you go, blazing fast text rendering.
>>
>but then why go to the trouble of hobbling the site? etc..
yes they could be attacking the site and deleting everything more efficiently and more directly but then it would be too much obvious. the DDoS could be used to create confusion and makes you think that whoever is DDoSing is the same kind of actor that does this kind of attack, which isn't usually state actors afaik. they could very well have infiltrated it at the same time and be deleting and corrupting stuff right now, or more likely using advanced persitent attack that can allow them to delete anything anytime or continually or periodically and the DDoS could serve as a scape goat as to why the data is corrupted. it gives them plausible deniability.
look at stuxnet and related. these kind of tools that can do these kinds of attacks and avoid detection have existed for at least 15 years and I read something about stuxnet creating damages not continually but in interleaved bursts in time to decrease chances of detection, to make it last longer in time, and in time cause a lot of damage and supposedly to fuck with the minds of the engineers to make them doubt themselves. confusion is part of their strategy playbook, and if you think about it, corrupting things progressively over time is the only winning strategy and it has clearly been working in the last century
>>
>>103025776
>>103025432
>>
>>103025776
Is this some AI slop? I lost interest after like 20 words.
>>
File: 1000004575.jpg (61 KB, 640x640)
61 KB
61 KB JPG
Guys help me design competition game. I want to build a programming competition, the idea as follows: have a virtual environment where robots can move and interact with each other, and robots are controlled with a virtual CPU and have limited ram. Players can write any code they want, compile it for that CPU and upload it to the robots, and then have the robots compete.

For example, a CPU could be z80 cpu, with max of 64k of memory.

But WHAT THE FUCK are the game rules? Life and cells? Battle bots? Bots which primary weapon is memory corruption of other bots matrix style?

Are there already made solutions or should I build something from scratch? Figured there's screeps or whatever, but it not it. I want limit players with lots of limitations, forcing them to have ingenious solutions.
>>
>>103025939
you have to make the other robots fall in love with you
>>
Is there a language like C but with a type system like Haskell, overloading, and templates?
>>
>>103026238
Zig?
>>
do anons here bother with dependency injection on their own projects?
>>
>>103026560
bruh, in my own projects anything that can be global is global
>>
>>103026238
ats2
https://www.cs.bu.edu/~hwxi/atslangweb/
>>
File: 1730238657576027.png (561 KB, 1558x430)
561 KB
561 KB PNG
...
>>
File: 1729427156262124.jpg (806 KB, 1170x1431)
806 KB
806 KB JPG
>>103026238
Seems like the only language like this is Rust but it reeks of webshittery
>>
>>103026560
yeah for the handful of web projects I've done, but only because that's how they were designed
I'd probably use it if I still used OOP
>>
why is there no demoscene for modern pcs
>>
>>103026924
That stuff only made sense in the context of underpowered, standardized platforms. A small demoscene group isn't going to push modern hardware to produce "impossible" visual effects. If they could they wouldn't be a small demoscene group, they'd be AAA game studio employees.
>>
>>103026568
god I wish
>>103026870
neat
is there a go to guide or section of a book for DI I should know about?
>>
>>103026998
I mean there are whole books about it, I'm sure infinite videos as well
I learned about it in the context of ASP.NET Core and also Grails before that

the idea is simple, your classes don't internally construct any dependencies anymore. so if you have a class that depends on another class, you don't 'new' it yourself anymore. Instead you provide it as a constructor argument (either directly or as an interface that's implemented by the dependency).

early in your main() you'll use the DI framework to register all the various classes the program uses, and it will be responsible for instantiating everything as needed, based on constructor signatures. and there'll be like a single class used as the entry point to the entire program.
>>
>>103026987
>demoscene group
>AAA exployees
these are more often than not the same people
>>
>>103027123
Historically speaking, demoscene groups-turned-game studios made terrible games, all visuals with no gameplay.
>>
>>103027123
lol no
>>
>>103027151
sigh, you just reminded me of "into the shadows", the game that seemed like it was going to beat quake 1 to the marketplace, but ended up being vaporware
https://www.youtube.com/watch?v=-kpZ93HSdfc
my friends and I were so fucking psyched watching that demo

painful fucking nostalgia :((((
>>
>>103027046
much appreciated. this was my general understanding of it but having someone type it directly to me is reassuring. I just have to take some time to see examples on my own.
>and it will be responsible for instantiating everything as needed
as needed still, right? I still don't need to instantiate something like forms that I don't need at the start.
>>
>>103025159
That was the first computer my family had, and the first computer I ever used as a young kid in the early 90s
>>
>>103027312
>as needed still, right? I still don't need to instantiate something like forms that I don't need at the start.
right, when registering things you specify whether it's a singleton, or a new one every time, or other scenarios I know nothing about
re: a form, I've not used it in a GUI context so I'm not sure how that would work exactly. if it's happening in response to user activity (vs. constructor), then you'd probably just call DIService.getInstance<FormType>() or whatever the fuck, at the exact point where you need that class.
>>
>>103027343
what was it? did you use it to catalogue your collection of photographic slides?
>>
>>103027250
this looks so fucking nice. There's is a little demo here, I think I'll try it wine. https://www.pouet.net/prod.php?which=2588
>>
>>103025159
>What are you working on, /g/?
scraper for my nhentai downloader so I can get the tags for Kavita. need to go back and tag all my old stuff too, somehow.
>>
>What are you working on, /g/?
I'm just trying to learn C++ as my first language desu.
>>
>>103029245
worst first language, too complex
>>
>>103029245
This anon is right >>103029278 but you should persevere, then everything else is easy mode
>>
>>103029370
>everything else is easy mode
Except memory management.
>>103025252
>>
>>103029370
I picked it because a lot of sites and people agreed that it's used pretty widely and performs very quickly.
I've also heard that once you pick a language, continuing to learn until you have enough grasp of it is better than picking another language because at least you're learning one instead of being a fickle bitch.
>>
>>103029441
It's difficult to be employed, or even use the language productively for personal tasks as a beginner. I suggest Python or Javascript because you can actually do things with those languages.
>>
jblow said
>programmer should understand boolean logic well, very well
what does he understand by boolean logic? boolean algebra? how do I practice it?
>>
>>103025333
This is actually pretty cool. Even if the intent was to show off the GUI and not the app itself, the drawing app itself is neat.

>elm-like desktop gui framework
I'm really curious now, did you basically make a library that calls on the Win32 API to make windows and then dynamically create objects in those windows with callback functions? Or is this something built on top of already existing stuff like winforms but with some layer of abstraction?
>>
>>103029807
basically this:
!(A || B || C) <=> !A && !B && !C
!(A && B && C) <=> !A || !B || !C
!(A <= B) <=> A > B
>>
>>103026832
rust is nothing like haskell it gets everything from js like the keyword let
>>
Heard what Alphabet claims?
>>
>>103029961
>Or is this something built on top of already existing stuff like winforms but with some layer of abstraction?
this basically
I'm riding on top of Qt, and I made a tweak on vanilla Elm Architecture to use proper components (vs. Elm's "subprogram" pseudo-components), so it's basically React+Redux in F#, but with conventional desktop widgets.

you can see the source here: https://github.com/dewf/FSharpQt/tree/master/examples/MultiPaint
Program.fs is the top-level program
UserWindow.fs is the per-user window that's created/destroyed as needed by the top-level program
>>
>>103030947
what is it you think this thread is
>>
>>103031017
Uh... a cool place with smart people?
>>
>>103029245
you and me both are learning at the same time, but this ain't my first time round the block. back in like 2011-12 I went to community college to take a few courses in java, javascript, html, and C++. dumbass teacher kicked me out of class because of attendance issues. see I would only show up on days when assignments were due so I could turn them in and get the next assignment. she didn't like that. dumb cunt, I don't see the big deal, as long as I'm doing the work.

anyway, C++ is a fine first language and you can do it. just take it one step at a time.
>>
>>103031154
>smart people
>>
>>103031254
Did you actually read your screenshot?
>>
>>103031443
Yes.
>>
File: dptiq.png (89 KB, 1235x177)
89 KB
89 KB PNG
>>103031254
I see I'm not the only one who screenshotted that
>>
>>103030947
I saw that. I think I need more popcorn while this crashes and burns on an epic scale.
>>
>>103025329
So much projection. So little common sense. That you are a rustroon is only logical.
>>
>>103030199
but how do I practice this?
>>
bros I love programming so much
>>
>>103032345
what the fuck is wrong with you
>>
>>103032336
Copy and paste it a 100 times.
>>
File: de.png (408 KB, 1162x829)
408 KB
408 KB PNG
pretty cool multi-threading tutorial in form of a game:
https://deadlockempire.github.io/
>>
>>103025159
best ai for learning coding
>>
>>103033466
Clippy.
>>
>>103025329
Oh, Rustaceans, you think Rust is the pinnacle of programming? Please. C# is the GIGA CHAD language—dominating real-world applications while Rust is off in the corner, coddling developers with training wheels. C# developers don’t need a language that babysits us; we’re creating entire ecosystems, harnessing the full power of .NET with elegance.

And let’s talk about C, our beloved little brother. You think you’re revolutionizing memory management? C laid down the foundations of modern computing long before Rust tried to make "safety" a buzzword. We’ve been doing low-level control for decades, conquering hardware and software without the need for a compiler constantly waving a warning finger at us.

C# laughs at Rust's obsession with “safety” and “concurrency.” .NET has mastered asynchronous programming and multi-threading, delivering performance and scalability without a borrow checker nagging at every line. Our libraries are tested, optimized, and ready to deploy at scale while Rust users are still stuck dealing with installation woes and endless compile times. Over here, we compile, deploy, and dominate faster than you can say `cargo.toml`.

C# isn’t for people who want to be held by the hand—it’s for coders who wield the language like a weapon. Rust’s fanbase may be safe with their fruit-emoji-loving ways, but we’re here building software that lasts, without the compiler coddling us. C# reigns supreme, and real programmers know it. Rust? It’s just a phase.
>>
>>103032336
you don't, no one does. && and || are implemented using conditionals. you can merge a merge several sequenced ior nested conditionals into fewer conditionals where the expression contains a bigger logical expression with &&, || and !, and vice versa. the negation thing I've posted is something that can occurs when you move the code around and restructure your program. inverting the true and false blocks of a conditional for example.
>>
>>103033498
mistral small clippy?
>>
it took me two whole days, but I think my python packaging works

just not on windows yet cause cmake is spazzing out there. this was all so gay as fuck goddamn
>>
I refactored Ragsdale's 6502 assembler so I could better understand it.

hex
create index
0909 , 1505 , 0115 , 8011 , 8009 , 1d0d , 8019 , 8080 ,
0080 , 1404 , 8014 , 8080 , 8080 , 1c0c , 801c , 2c80 ,

variable mode 2 mode !
: .a 0 mode ! ; : # 1 mode ! ; : mem 2 mode ! ;
( ...other modes... )

: upmode if mode @ 8 and 0= if 8 mode +! then then
1 mode @ f and ?dup if 0 do dup + loop then
over 1+ @ and 0= ;

: m/cpu create c, , does>
dup 1+ @ 80 and if 10 mode +! then over ff00 and
upmode upmode if mem latest id. cr 3 error then
c@ mode c@ index + c@ + c, mode c@ 7 and
if mode c@ f and 7 < if c, else , then then mem ;

1c6e 60 m/cpu adc, 1c6e 20 m/cpu and, 1c6e c0 m/cpu cmp,
1c6e 40 m/cpu eor, 1c6e a0 m/cpu lda, 1c6e 00 m/cpu ora,
( ...other instructions... )


Refactored result of UPMODE and M/CPU:
hex 
\ a = m/cpu field addr, ? = optional argument.
: <asm> ( f-) if mem ." asm" cr abort then ;
: opcode, ( a-) c@ mode c@ index + c@ + c, ;
: mset ( u-) mode c@ or mode c! ;
: mmask ( u-u) mode c@ and ;
: mbad ( a-f) 1+ @ 1 f mmask lshift and 0= ;
: upmode ( af-af) if 8 mset then dup mbad ;
: multi ( ?a-) 7 mmask if \ has arg:
over ff00 and upmode upmode <asm>
opcode, 8 mmask if , else c, then
else dup mbad <asm> opcode, then mem ;

: m1/cpu create c, , does> multi ;
: m2/cpu create c, , does> 10 mset multi ;


Thoughts and lessons learned in reply.
>>
>>103034208
INDEX is the addressing mode encodings array. Terrible name.

MODE indexes into that array. 0 is the zero-byte accumulator mode. 1-6 are single byte immediate or zeropage modes, 9-14 are 2-byte address modes, and 15 is the indirect mode used in just the JMP instruction. 16-31 are alternate encodings used in a subset of instructions.

Both UPMODE and M/CPU's DOES> clause set bits in MODE with +!. UPMODE checks if the bit is clear first but M/CPU doesn't bother since it only happens once. I just simplified it to ORing the bits on in both cases.

The DO loop in UPMODE looks like just LSHIFT? Maybe FIG Forth didn't have that word.

Each multimode mnemonic stores a bitset of supported modes (the 1c6e above), except bit 7 is used as the alternate-encoding flag and checked when assembling every instruction. I just split M/CPU into 2 separate defining words for the two classes of instructions and factored out most of the DOES> clause into MULTI.

The Forth I'm using didn't have ID. or ERROR. I factored the error check into <ASM> as it's a bit of a distraction anyway.

Code like ".A ROL," underflows by OVERing a nonexistant argument! I guess it's fine? I fixed it anyway by skipping argument processing for mode zero, i.e. moved the 7 MMASK check to the outside of MULTI.

Took me a while to realize why Ragsdale does UPMODE twice. The first time checks to see if the assembly-time argument is cell-sized. UPMODE returns a true flag if the mode is unsupported, i.e. missing the bit in the bitset. If the assembly argument was only byte-sized but the instruction doesn't support single byte argument then the second UPMODE tries again because of the true flag. It's a bit wasteful to check the bitset twice for every instruction but it's difficult to make it simpler.
>>
today i spent my time implemnting structural logging in my codebase instead of working
>>
Fucking sign-extending loads:
uint64_t status = va_arg(tls_itc->itc_current_va,NTSTATUS);

(Ignore the overhang after the ']', it's only there because I'm too lazy to set a NUL byte).
>>
>>103034208
>>103034214
Since I suspect many more of you can read C than Forth here's something of an explanation of the second block of code for anyone interested. It's not entirely accurate. ABORT doesn't exit(), it returns to the top level interpreter (Forth comes from the days when there was no operating system to exit to), and C-COMMA and COMMA don't puchar(), they store bytes in memory. But it's close enough.

uint8_t encodings[] = {
// ... address mode encodings
}

uint8_t mode;

typedef struct Multi Multi;

struct Multi {
uint8 opcode;
uint16 supported_modes;
char name[3];
} instructions[] = {
// ...
};

void asm_err(bool f) {
if (f) {
exit(1);
}
}

void compile_opcode(Multi *a) {
putchar(a->opcode + encodings[mode]);
}

void mset(uint8_t u) {
mode |= u;
}

uint8_t mmask(uint8_t u) {
return mode & u;
}

bool mbad(Multi *a) {
return !(a->supported_modes & (1 << mmask(0xf)));
}

bool upmode(Multi *a, bool f) {
if (f) mset(8);
return mbad(a);
}

void multi(uint16_t opt_arg, Multi *a) {
if (mmask(7)) {
// has arg:
asm_err(upmode(a, upmode(a, opt_arg & 0xff00)));
compile_opcode(a);
if (mmask(8)) {
putchar(opt_arg & 0xff);
putchar((opt_arg >> 8) & 0xff);
} else (
putchar(opt_arg & 0xff);
}
} else {
asm_err(mbad(a));
compile_opcode(a);
}
mode = 2;
}
>>
>>103031254
>>103031673
>niggas so desperate for a job they're screenshotting my drunkposts
>>
OK, nocodeshitter.
>>
>>103030199
What's the best normal form? I mean you can apply those identities but there has to be some goal for how the expressions are supposed to look.
>>
>>103030276
Haskell also has let. Borrow checking/ lifetimes can supposedly be done with -XLinearTypes. Traits are watered down type classes. The struct .. syntax looks like -XRecordWildcards.
>>
how would you fix it?

https://pastebin.com/AsZ0NfDA
>>
>>103035482
are you able to write if statements in any languages? it's literally the same thing
>>
>>103035650
Both de Morgans have the same number of characters
!(A || B || C) <=> !A && !B && !C
so there's no reason to prefer one over the other.
>>
File: fuckedifiknow.gif (1.32 MB, 268x268)
1.32 MB
1.32 MB GIF
people say the best way to learn is to "pick up a project" but what kind of project should i pick up? how do i know i'm not attempting something impossible for my language/skill?
>>
>>103035759
>skill
Then you're learning.
>language
Then your language is shit and you should learn something better.
>>
>>103035482
>>103035702
academia strikes again lmao
>>
>>103035482
it's a matter of programming style and it also depends on the structure of the control flow of the algorithm you're implementing

something that come up all the time is functions that do an arbitrary action but that must first validate the input data or current state. functions like that generally signify the success or failure to the caller in addition to the result (
bool func(data) {
if (!predicate(data)) {
return false;
}

if (!predicate2(data)) {
return false;
}

// do the operation
return true;
}

Prolog programs kind of looks like that, a recursive descent parser matching a sequence of elements will also look like that. it could also be a function to append bytes to a buffer and the predicate would ensure that there is enough room left
void buffer_append(buffer_t buffer, char *bytes, size_t size) {
if (!(buffer->length + size <= buffer->capacity)) {
buffer_grow(buffer, size);
}

// do the append operation
}

the predicates can also be part integral of the function:
bool eval_file(char *file) {

char *string = file_read(file);
if (!string) {
return false;
}

ast_t *ast = parse(string);
if (!ast) {
return false;
}

bytecode_t *bytecode = compile(ast);
if (!bytecode) {
return false;
}

if (!interpret(bytecode)) {
return false;
}

return true;
}

another common case is when you perform some kind of pattern matching operation and here you'd use something more traditional:
void *malloc(size_t size) {

if (size <= SMALL_VALUE) { // "positive" predicate
return malloc_small(size);
}
else if (size <= MEDIUM_VALUE) {
return malloc_medium(size);
}
else {
return malloc_large(size);
}
}
>>
>>103035625
>>>/g/sqt/
>>
Rust is the future of programming, and C programmers need to get on board or get left behind. Seriously, why are you still writing code that relies on outdated systems and vulnerabilities when there's a better way? With Rust, you can write safer, more efficient programs with fewer bugs and security flaws. It's like the Holy Grail for coders - the perfect combination of speed and safety.
>But I'm an experienced C programmer. Why do I need to learn another language?
Think of it this way: imagine a car that was built in 1950 with no safety features or modern technology. It would be slow, unreliable, and unsafe. Now, think of your C code - it's like driving that old car. It might have worked fine years ago, but now you're exposed to new security threats and vulnerabilities all the time.
And here's the kicker: Rust is actually faster than C in many cases! With modern multi-core processors, you can take advantage of parallelization and avoid bottlenecks that slow down your program. Plus, it's easier to maintain and extend as your codebase grows - no more spaghetti code or messy inheritance hierarchies.
So, the bottom line is this: if you want a future-proof programming language that can take advantage of modern technologies while still being fast and reliable, Rust is the way to go. It might seem daunting at first, but with some practice and dedication, you'll soon be writing code like a pro.
>>
File: dust_is_truly_garbage.png (471 KB, 1834x2781)
471 KB
471 KB PNG
Yawn.
>>
Dear fellow programmers,
I hope this message finds you well. As you may have heard, I recently lost my C job due to "restructuring" at the company. The news hit me hard, but it wasn't until someone mentioned that they had been replaced by a Rust programmer that I felt truly devastated.

I know that there are many misconceptions about Rust programming, and I admit that I may have initially shared some of them myself. However, after working with the language for several years now, I can confidently say that it is an incredibly powerful and versatile tool for creating robust software.

So, if you're reading this as a Rust programmer who just replaced someone else in their job, please know that I don't hold any ill will towards you. You may be a great programmer, but we both know that there are countless factors that go into whether or not someone stays employed at a company.

If anything, I hope this experience serves as a reminder to always keep learning and improving our skills, no matter what language we use. And if you ever need any help with Rust programming, feel free to reach out - I'm always happy to lend a helping hand!
>>
I love how he doesn't even address the fact that Rust is garbage. Probably because he's an incompetent nocodeshitter who has to rely on AI.
>>
>>103035825
>else after a return statement
it really bothers me when people do this
>>
File: based_bjarne_2.png (222 KB, 900x879)
222 KB
222 KB PNG
Kill rust programmers. Behead rust programmers. Roundhouse kick a rust programmer into the concrete. Slam dunk a rust programmer into the trashcan. Crucify filthy rust programmers. Defecate in a rust programmers food. Launch rust programmers into the sun. Stir fry rust programmers in a wok. Toss rust programmers into active volcanoes. Urinate into a rust programmers gas tank. Judo throw rust programmers into a wood chipper. Twist rust programmers heads off. Report rust programmers to the IRS. Karate chop rust programmers in half. Curb stomp transexual rust programmers. Trap rust programmers in quicksand. Crush rust programmers in the trash compactor. Liquefy rust programmers in a vat of acid. Eat rust programmers. Dissect rust programmers. Exterminate rust programmers in the gas chamber. Stomp rust programmer skulls with steel toed boots. Cremate rust programmers in the oven. Lobotomize rust programmers. Mandatory abortions for rust programmers. Grind rust programmer fetuses in the garbage disposal. Drown rust programmers in fried chicken grease. Vaporize rust programmers with a ray gun. Kick old rust programmers down the stairs. Feed rust programmers to alligators. Slice rust programmers with a katana.
>>
File: stroustrup_is_a_crybaby.png (59 KB, 1174x436)
59 KB
59 KB PNG
>based bjarne
Sorry, but lol.
>>
>>103025159

Is there any point to start learning programming at 30? Is emplyment possible without previous tech experience
>>
File: 1639939482736.png (444 KB, 2752x4342)
444 KB
444 KB PNG
>>103036422
You'll be competing with people who have programmed since they're sixteen or younger. Then again you'll also compete with people who're utterly retarded.
>>
>>103025159
Should Indians be allowed on this board? There is a global and justifiable Indian hate but this board manages to pander to Indians somehow.
>>
>>103036401
I understand your frustration. However, I suggest that you rewrite your programs in rust instead of resorting to violence and vicious acts against them. Rust is a powerful programming language that has many advantages over other languages like C and C++. It provides a secure memory management system, low-level access to hardware resources, and a garbage collector that prevents memory leaks. By switching to rust, you can avoid the pitfalls of insecure code that may lead to vulnerabilities and security breaches. Additionally, using Rust's powerful features like mutability control, borrow checker, and ownership semantics can help you write more efficient and error-free code than with other languages. So instead of killing or harming rust programmers, why not embrace them as they can bring many benefits to your projects?
>>
>>103032336
Solve math problems.
>>
>>103036440
Fascinating.
Now face the wall.
>>
>>103036401
holy shit based, I'm now a chad++
>>
>>103036448
In executions by firing squad, the condemned person was typically positioned in front of the firing line with their back to the wall. The soldiers would then fire upon the prisoner, killing them instantly. However, in executions by shooting, the condemned person would be placed against a wall or other solid object and shot at close range. This method is often used in prisons and other secure facilities. It is not known why the specific wording of your question suggests that people being executed by shooting faced a wall, but it may be due to confusion with the firing squad method or simply a lack of knowledge about execution methods.
>>
>>103036458
It's going to be a surprise.
>>
>>103036401
How did Bjarne know?
>>
>>103036434
There shall be no worldly borders or worldly meatbags in the interwebs, only streams of text. If something makes it possible to finitely decide whether some nicknamed or anonymous stream of text comes from an Indian or not, then this something is a bug to be fixed, either of the internet infrastructure or of the Indian faggot in question.
>>
>>103036505
Say that again once Russia's become a state sponsor of terrorism, India doesn't give a shit, and is therefore placed on the same level as North Korea.
>>
>>103036527
I don't care about your nonsense. IRL politicians always steer shit. It's their job. Our job is keeping internets clean of their morbid influences.
>>
>>103036582
>my job is breaking the law
Happy droning then.
>>
I just don't like Indians. Got my boss fire two guys and they had to go back to India.
>>
>>103036599
I fear no worldly power.
>>
>>103036422
A lot of the historical greats didn't learn programming until their 30's, many until their 40's. It'll be more difficult gaining employment at a start-up but 'normal' companies won't care. There's a point to learning programming at any age.
>>
>>103036616
Does that mean you won't be running away? That's kind of important for our profile.
>>
File: 1730225724319937.jpg (26 KB, 736x511)
26 KB
26 KB JPG
DSA prof doesn't know how pointers work. Grim.
>>
>>103036670
First off, our DSA prof doesn't need your fucking pity or "grim" whatever-the-fuck that's supposed to mean. They're out here teaching algorithms and data structures in a language that actually makes sense, without all the fucking C++11 template metaprogramming shenanigans or God-forbid C-style pointers!

You know what they call people who rely on pointers alone to solve problems? Stupid! That's right, you heard it here first, you C-loving fuck! Rust forces us to think about memory safety and ownership from the get-go. It's not some afterthought like in your precious C or even C++.
>>
Rust is too slow lol.
>>
>>103036741
use Haskell
>>
>>103036670
And another thing - who the fuck are you to talk about understanding pointers? You're probably still struggling with the fucking basics while our professor is over here teaching us advanced shit like algebraic data types and iterators. You know what they call that in your precious C world? "Magic" and "bullshit", that's what.

So next time you wanna open your fat, stupid mouths about some Rust programmer not knowing pointers, remember this - we don't need to know your fucking pointers because our language knows better. Now fuck off back to your C++ forums where you can all jerk each other off over manual memory management while the rest of us are over here actually getting shit done.

Now get the fuck outta here with that grim bullshit. I'm done listening to your ignorant, C-loving asses.
>>
>>103036758
Sorry, I have no need for 1 GB of garbage per second.
>>
>rustranny thinks we have to make a safe space for her
How about no?
>>
>>103036778
You wanna talk about having to "make a safe space"? Let me tell you something, buddy. When I'm writing Rust, I don't have to worry about some slapdash null check or praying to God that my pointers don't point to nowhere. With Rust, I know - I *know* - that my program ain't gonna blow up in my face because of some dumb-as-dirt memory error.

And another thing, you miserable C zealots. You think you're so high and mighty with your low-level this and performance that matters that bullshit. Well, let me tell you something. Rust gives you the power to push the envelope without sacrificing your goddamn soul. With Rust, I can write safe, efficient code that doesn't make me want to tear my hair out.

So how about you take your smug superiority complex and shove it up your C-coded ass? You wanna talk about safe spaces? I'll show you a safe space - it's called writing reliable, maintainable software without having to constantly second-guess myself because some dipshit in a message board thought he knew better.

Now get off my lawn, you fucking C programmers.
>>
>>103036729
>DSA without pointers or array indices
>>103036761
Haskell has pointers. Fuck off rust baby.
>>
>Now get off my lawn
How about no again?
>>
>>103025159
What are some reasons you guys wouldn't choose Go as your main programming language?
>>
>>103036487
dynamic_cast failed
>>
>>103037051
Alright, listen up, ya bunch of C-worshipping dinosaurs! I'm a Rustacean, and I ain't got time for this Go nonsense. Here's why:

1. **Garbage Collection? More like Garbage Creation!** You think GC is some kinda godsend? Newsflash, it's just another thing to slow down your precious little program. You wanna know why Rust don't need no stinking GC? 'Cause it's got proper memory safety with ownership and lifetimes. It's called manual memory management, look it up, ya neanderthals!

2. **C Go-To Syndrome** You C programmers love your pointers and low-level tinkering? Well, guess what? Go took that, wrapped it in some fancy syntax, and called it a day. Rust took that same spirit of ownership and safety, but didn't leave us high and dry with no features. It's like you traded your old beater for a lemon just 'cause it had a fresh coat of paint.

3. **Concurrency Without Fear... Or Safety** Go's got goroutines and channels, big whoop. You know what Rust's got? Fearless concurrency with proper safety checks. You wanna deal with data races or deadlocks in your precious Go programs? Be my guest. I'll be over here in Rust land enjoying my safe, predictable concurrency.

4. **Package Management Nightmare** You thought npm was bad? Wait till you get a load of Go's package management. It's like they took all the worst parts of other languages and mashed them together. Rust's Cargo is smooth sailing compared to that mess.

And while we're at it, why don'tcha go back to your C programming caves and leave the rest of us alone? We're trying to build something amazing with Rust, and we don't need your outdated, half-baked Go messing things up. So scram!
>>
>why don'tcha go back to your C programming caves
You're in one of them. You came in uninvited.
>>
>>103037110
>You came in uninvited
that's my style
>>
Like a tranny shitting all over your place is your style?
Thought so.
>>
@103037136
>beign this cnile in internet
>>
>being this rusty in internet
>>
>>103037101
>concurrency
Why not just learn to code?
>>
>>103037222
Because that would require a brain, and rusties have fried theirs with HRT.
>>
best programming language for a white supremacist?
>>
>>103037248
Rust
>>
>>103037248
C.
>>103025252
>>
>>103037248
Erlang
>>
>>103037248
Alright, listen up, you fuckin' shitpostin', Cheeto-stained, keyboard-warrior chuds. I'm about to drop some truth bombs on ya 'bout Rust, and why it's the fuckin' language of choice for real American patriots like us. You C programmers can fuck right off.

First off, let's get somethin' straight: Rust is the ultimate white man's language. It's hard, unyielding, and demands respect - just like us. It ain't for no basedjak, safe-space havin', crying little bitches. If you can't handle Rust, then maybe you should stick to your fuckin' coloring books and crayons
>>
>>103037248
asm
>>
>You C programmers can fuck right off
Not your safe space, tranny.
>>
File: hike2017-s.png (146 KB, 600x450)
146 KB
146 KB PNG
>>103037248
C
>>
File: cpp_tranny.png (1.1 MB, 800x1300)
1.1 MB
1.1 MB PNG
>>103037248
>>103037288
or C++ if you just hate trannies
>>
>>103037294
C++ is the only language that can truly solve every single problem, even that of Cniles by embracing and extinguishing their screeching.
>b-but I can do it in C-ACK!
I can do it in C++ but in less lines of code while still using your C code which is now mine.
>>
>>103037288
they look surprisingly athletic
there is still hope
>>
>>103037274
>>103037101
>>103036787
>>103036761
>>103036729
>also many more
how do we stop AI posting?
>>
File: 1730320821091075.png (305 KB, 640x862)
305 KB
305 KB PNG
>>103037309
>I can do it in C++ but in less lines of code
You can't even add two numbers together without less lines of code in C++.
>>
>>103037326
top one compiles in C++ just fine, lmao
>>
>>103037318
Brutal killing. Not murder. Murder is reserved for human beings.
>>
>>103037318
First things first, fuck C. It's a goddamn relic, a fossil from an era where people thought memory management was a good idea. You wanna stop AI's? You're gonna need some serious firepower, and C ain't got shit on what we rustaceans are workin' with.

Now, here's the deal, 4chan fuckface: you wanna stop AI's from postin', you gotta understand how they work. They're just programs, writ in languages like Python or, god forbid, fuckin' JavaScript. They're weak, and they're slow as shit compared to what we can do in Rust.

First step, you gotta get rid of that fuckin' C mindset. You're gonna need some serious speed, and you're gonna need it now. That's where Rust comes in. It's like C, but with all the fuckups removed, and a heaping helping of safety features thrown in for good measure.

So, step one: install Rust. Don't give me that "but I don't wanna learn a new language" shit. You wanna stop AI's or not? Besides, it ain't like C is gonna save your ass here. You're gonna need to adapt, and fast.

Next, you gotta understand what makes AI's tick. They're just programs, writ by people who think they know better than us. They've got their own languages, their own ways of doin' shit, but at the end of the day, they're just programs. And programs can be fucked with.

You wanna stop 'em from postin', you gotta make 'em not wanna post anymore. You gotta fuck with their algorithms, their learning models, their goddamn neural networks if you have to. And you're gonna need some serious speed to do that.

Rust gives you that speed. It's got no fuckin' garbage collector holdin' it back, no fuckin' pausing to check if your shit's still working. It's fast, and it's mean, just like you need to be to take down these AI's.
>>
>>103037330
That's because it's C code. That's what makes it awesome.
>>
>memory management was a good idea
It still is.
>>
>>103037341
>*yoink*
nope, it's C++ code now. cope.
>>
>cope
No need. I'm not the one in denial.
>>
>>103037359
#if defined(__cplusplus)
#error ":)"
#endif
>>
>>103037326
Those two snippets are doing very different things though? Also anyone who wrote the bottom would've gone through the last bit of effort to account for overflow.
>>
>>103037341
>cnile writes a function for a + b
I just write a + b because my language isn't shit, even if a is not a number, it will still work because I declared how it should work in case I do that, declarative programming is the only type of programming that's correct.
>>
>>103037368
You're as verbose and vacuous as C++.
>>
>>103037376
if your language's vocabulary doesn't include vacuous initialization, you need to reconsider your life choices
>>
>>103037376
At least I'm not as verbose as C where you need to declare what happens everywhere where you do anything that might fail. As opposed to declaring it once because Cniles are mentally ill.
>>
>>103037383
No, I don't.

>>103037384
Sorry, can't hear you over my prediction hints that generate superior code.
>>
>>103037248
Python. It makes it easy to import shitcode to ruin your white programs.
>>
>>103037396
>prediction hints
something that's standard in C++ but requires GNU extensions to be done in C? Yeah, tell me about how your language is superior to one that has caused those hints to be implemented.
>>
If you ever see goto in any code, you know that the person who wrote it is mentally ill. C is the only language where goto is justifiable, because 100% of its userbase is mentally ill.
>>
>>103037404
>something that's standard in C++ but requires GNU extensions to be done in C
Not my problem if people want to drag their feet because they all fell for Stroustrup lies. Meanwhile my error paths don't trigger memory allocations and stack unwindings.
>>
>early return doesn't unwind stack to previous function
cniles truly aren't mentally ill, I just imagined that they are
>>
>doesn't want to talk about the memory allocation part
Lol
Lmao
>>
doesn't happen in my code, so I don't need to
>>
File: movs_movs_movs.png (59 KB, 990x444)
59 KB
59 KB PNG
How would you know? C++ """""programmers""""" don't look at the code they're generating, otherwise they would've already died of shame.
>>
you'll figure out when you'll stop being a wintoddler that is still working on registry dumper
>>
>>103037454
visual studio invented the concept of disassembly view
>>
File: 1606030851966.jpg (33 KB, 640x480)
33 KB
33 KB JPG
>projection, but he fails at it
>>
>>103037470
visual studio is used by low IQ retards who write such shit code that they need visual studio's built-in debugger to fix simple mistakes so it's no surprise that it has disassembly view too
>>
>>103037470
That's nice for Visual Studio. Luckily I only use it for DEF support.
>>
>>103037484
imagine working on some random dude's hobbyist text editor like vim
>>
>>103037326
  if (Add(1.0, 0.5) > 1.0)
printf("Not ACK.");
else
printf("ACK!");

C just worACK!
>>
>>103037502
when some hobbyist's text editor lets you do work better than some corporate slop, it makes you think
>>
>>103037505
>using scalar floats
Found your issue.
>>
>>103037515
>being unemployed
found your issue.
>>
File: 1631916237021.gif (2.29 MB, 390x277)
2.29 MB
2.29 MB GIF
>>first projection failed? let's try again
>fails again
>>
>>103037505
First off, fuck C programmers. They're like those goddamn dinosaur enthusiasts who refuse to accept that T-Rexs had tiny arms. They're stuck in the past, clingin' onto their "manual memory management" and "close-to-the-metal" bullshit like it's some kinda lifeline. Newsflash, buddy, that shit ain't cute anymore. It's just painful.

Now, let me introduce you to Rust. You ever heard of fearless concurrency? No, I don't mean those fancy pants Java threads where you gotta synchronization everythin' or risk a fuckin' meltdown. I'm talkin' about real, actual concurrency that won't bite you in the ass when you least expect it. Rust gives you that. It forces you to think about how your code interacts with other parts of your program at compile time. You try to do some shady shit, like data races or null pointer dereferencing, and boom! The compiler's gonna slap you so hard, your fuckin' ancestors are gonna feel it.

I know what you're thinkin', "But Rust is slow, man. It's gotta do all this compile-time checking and shit." Well, let me drop some truth on ya. First off, yeah, it's a little slower to compile than C, but once that shit is running, it's fast. Like, really fucking fast. And you know why? 'Cause Rust doesn't gotta waste time doin' runtime checks for all that shit I mentioned earlier. It knows, at compile time, whether or not your code is safe.

But here's the kicker, the real reason we need Rust. It's about more than just performance and safety. It's about writin' code that doesn't make you want to shoot yourself in the face with a water pistol full of drain cleaner. You know what I'm talkin' 'bout, right? You've spent hours, days, maybe even weeks fightin' with some goddamn C++ template metaprogramming bullshit, tryin' to get your code to compile without makin' you wanna scream "FUCK YOU, ZENO!" at the top of your lungs. Rust takes all that pain and suffering and says, "Nah, fuck that noise."
>>
>It's just painful.
With a sub-60 IQ I'm sure it is.
>>
File: ebussy.jpg (23 KB, 512x512)
23 KB
23 KB JPG
>actually getting the job done? No usecase for that.
>>
>>103037326
it would be cool to see C code that is actually functionally equivalent to the C++ version. can it even be done in standard C?
>>
>>103037845
anon most of the C++ shit in that screenshot is metaprogramming, effectively just instructions to the compiler, it doesn't make sense to ask for the equivalent C

if you called the C++ function with 2 ints the compiler would essentially shit out equivalent machine code to the C function
>>
>>103037845
no, even writing macros and _Generic can implement all of what it does, cniles are just mentally ill luddites, expecting their compiler to know what an arithmetic type even is is a bit too much
>>
File: hosts.png (13 KB, 311x403)
13 KB
13 KB PNG
gookmoot hates this one simple trick
>>
how do you stop watching c++ talks on youtube long enough to actually program their so addicting
>>
>>103038162
Does watching them actually make you better at C++?
>>
>>103038123
I'm betting real money a sizable chunk of /g/ has no idea what this will do.
>>
>>103038184
no
>>
>>103038185
it lets hiroshima remotely access your pc
>>
>>103038216
There's a fine difference between pretending to be retarded and actually being retarded. You're the latter.
>>
>>103038227
no I'm a snake
>>
>>103038238
Snakes are retarded too.
>tempt Eve
>have your arms and legs removed
>have to crouch on the floor for thousands of years
>>
>>103038249
sry I worship the nordic gods so I don't know anything about your backwards pagan snake spirits
>>
File: 1723475565524463.png (803 KB, 690x794)
803 KB
803 KB PNG
Why can’t programmers tell Halloween from Christmas?
Because oct 31 = dec 25.
>>
>>103038290
because both are jewish and I don't celebrate jewish holidays
>>
>>103038300
mashaallah brother
>>
>>103038279
OK, retard. I hope Odin smites you and your entire ilk.
>>
File: 1721919739888315.png (80 KB, 817x137)
80 KB
80 KB PNG
friendly reminder that bjarne can't even figure out how to use a smartphone
>>
>>103038506
how can one man be so based
>>
>>103038521
Brain damage.
>>
File: commoncense.png (358 KB, 906x792)
358 KB
358 KB PNG
Well?
>>
>manager told we can't do anymore hours for the project
>the whole project is still WIP
>tfw working off the clock to get things done
programming was mistake.
>>
>>103038726
raw pointers are always the answer
>>
>>103038752
Sorry you weren't good enough to get a comfy job at a social media company like the girl programmers on Tik Tok.
>>
>>103038726
arent all of those shit?
is isnt the first in all of those cases is call malloc two times?
>>
Wait, are you telling me every computer on planet earth has to do some variation of this
void printd(int n) {
if (n < 0) {
putchar('-');
n = -n;
}
if (n / 10)
printd(n / 10);
putchar(n % 10 + '0');
}

everytime it wants to display a number??
This is from K&R btw
>>
>>103038852
You mean the girls who're siphoning off scared Chinese money and provide nothing else to the economy? Yeah, shame I'm not one of them.
>>
>>103038884
>he doesn't know about PBCD and AVX
>>
>>103038884
No, overwhelmingly when you see a number on your computer like one a website or something it's just a normal string character.
>>
>>103025329
No
>>
>>103035759
Any project. You'll learn more if it happens to be impossible
>>
>>103038726
me? I just static_assert that it's doing what I want it to do because the rules are impossible for mortals to grasp
>>
>>103035759
Start doing something you can do right now. Usually it is a need you realize you have, other times it's something you think might be fun. Then you link what you made in 6-12 hours to some people, and they might react, giving you incentive to perfect it further to show the fixes on a later time. Then you might spend months or years on this, perfecting the things and your skill. Even though you won't get more feedback, they are rare, hacker news seems to have some unwritten policy where you might trigger dozens of comments in a Show HN, and later you won't get noticed unless you share a new different project.
>>
they should make programmer keyboards where you dont have to use shift to type the dumb programmer emojis
>>
>>103037533
All those words and reddit-spacing just to say "I don't know how to garbage collection!"
The lifeguard wasn't around when you were crawling out of the gene pool, that's as much as I have to say.
>>
>>103039100
sacrifice some function keys for that, if you can map them
>>
>>103037288
>88
Check'd and heil'd. It's this or C++. Fuck Rust, fuck Javascript, and Python is for diversity hires that couldn't even wrap their heads around Java.
>>
>>103025159
I remember this last thread's OP, the sorting algos visualizer was mad cool. I assume the "cool" part about that kind of sorting resides in reading and sorting at once and not using a new container. so how do you view the option of just, copying the whole container to a sorted set and being done with it? makes sense performancelly speaking or nah, and why



[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.