Elektrine lite

← Feed

@iopq@lemmy.world

Post #3966196

2026-07-20 18:10 UTC

Nobody is arguing C is complex. The argument is that it’s not the optimal syntax. For example, case statements needing breaks can cause logical issues with incorrect merges. How about this en.wikipedia.org/wiki/Unreachable_code#goto_fail_… The if statement not requiring brackets caused this bug. Rust fixes these issues with pattern matching and mandatory curly braces in if body statements

Replies (1)

  • @Nalivai@lemmy.world 2026-07-20 18:41

    Yeah, it’s not optimal, I don’t think anyone argues that it is. It has a bunch of ways to shot yourself in the foot, no questions about that, people were writing books about that for decades. But also, a lot of that non-optimality is what gives it advantage. Well, that and enormous amount of legacy code and expertise. Sometimes you need to pass around raw pointers without caring about memory ownership, and for that situation it’s optimal. I’m glad you have your mandatory curly brackets, but sometimes I just want my microcontroller to blink an LED and for that I’m in turn glad that I can be as quick and dirty as my filthy mind allows me. And for serious projects we’re all MISRA compliant anyway, and it mandates curly brackets for ifs and proper cases for switch.

    Open ##3966872