Post #2505877
2023-11-03 18:23 UTC
Replies (20)
-
@atax1a@infosec.exchange 2023-11-03 18:24
@thephd@pony.social as we continue to insist, a modern "language that lets you access the hardware" would allow you to annotate your data structures for cache-tier-occupancy.
-
@gsuberland@chaos.social 2023-11-03 18:28
@thephd@pony.social I have literally run C# on a microcontroller and it had no problem poking at registers and memory, so yeah, C is definitely not special here.
-
@jaycie@tech.lgbt 2023-11-03 18:29
@thephd@pony.social This! Yes, this! Ahhhhhhhh.
-
@jrose@social.belkadan.com 2023-11-03 18:30
@thephd@pony.social My brain is saying “but volatile exists!” and I’m responding with “no, it doesn’t”. Which is not true but it’s close enough.
-
@ids1024@fosstodon.org 2023-11-03 18:34
@thephd@pony.social "your computer is not a PDP-11" - Hm, has anyone made a Mastadon client for the PDP-11 yet? Then they can yell at their VT100 when you make a comment like this. Not only is pure conformant ISO C insufficient for kernel or embedded development. How many non-trivial C applications or libraries at all are actually portable to all conformant implementations? (No OS specific calls, doesn't assume 8 bit bytes, works with 16-bit ints...) You see enough trouble with endianness and alignment.
-
@shac@ioc.exchange 2023-11-03 18:40
@thephd@pony.social When you’re telling your users they’re using it wrong, perhaps it’s time to reevaluate what product you’re actually making.
-
@icedquinn@blob.cat 2023-11-03 18:42
@thephd@pony.social it was supposed to be 'readable assembly' i use nim these days though its comfy
-
@srtcd424@mas.to 2023-11-03 18:56
@thephd@pony.social I was a C stalwart for a long time, probably too long, but agreed the time to make the switch to something better is well overdue. Hell, even Linus 'Mr Grumpy' Torvalds is letting rust into the kernel!
-
@duk@nothing-ever.works 2023-11-03 18:56
@thephd@pony.social
-
@sudo200@layer8.space 2023-11-03 18:56
@thephd@pony.social C is not magic, its semi-portable assembly, it is useful for abstracting away the platform-specifics, like registers and instructions. And while it might sometimes be useful to return a stack address from a function or do other equally unsafe operations, it would at least help, if you had to explicitly define them as unsafe, like you have to in Rust.
-
@sjolsen@tech.lgbt 2023-11-03 19:01
@thephd@pony.social oh but C's language constructs map almost one-to-one to ISA constructs (vector extensions? fences? never heard of them), which are themselves definitely representative of how modern hardware works (register renaming? what's that?)
-
@lanodan@queer.hacktivis.me 2023-11-03 19:20
@thephd@pony.social Which is quite why I'm strongly on "low-level is assembly or 1:1 translation of it, like with macros" (with still acknowledging that binaries are themselves interpreted+optimised by the hardware) and then having distinctions like system-oriented, applications, data processing, … And to me a big part of why C and the like are not low-level is how there's a lot of "I cannot know what the result will look like, unless I use workarounds" like with how bitwise operators are used for manipulating bitfields, instead of directly using a struct, as those are reordered and padded for alignment (and efficiency).
-
@a1ba@suya.place 2023-11-03 19:30
@thephd@pony.social write in C because you like it, not because it supposedly makes the computer go fast, when that could be achieved with other tools.
-
@Tathar@dragon.style 2023-11-03 19:48
@thephd@pony.social Case in point: Embedded C exists *because* regular C doesn't directly control the hardware.
-
@bersl2@furry.engineer 2023-11-03 20:00
@thephd@pony.social What, then, is your vision of a future without C?
-
@gsuberland@chaos.social 2023-11-03 20:05
@thephd@pony.social on this note, do you think it would even be feasible to create a language that has "real" direct control of the hardware, insofar as the microarchitectures allow, with more than one architecture being supported? and would that even be recognisable as a "language" in the traditional sense of expressing types and goal-orientated abstractions, rather than essentially just being a procedural IL assembler/preprocessor toolchain that supports trivial structs?
-
@orc@eightpoint.app 2023-11-03 20:24
@thephd@pony.social Selfishly, I wish that some modern computers were pdp-11s, because the iron shackles of minimal easily addressable core tends to encourage tighter code.
-
@LoganDark@tech.lgbt 2023-11-03 20:42
@thephd@pony.social "magic shroom thinking" actually even psychedelics don't usually impact your judgement this much
-
@datenwolf@chaos.social 2023-11-03 21:14
@thephd@pony.social All true and right. Yet, I still long for C compilers to just *tell* me (as a warning, that I can lift to an error), if code gets optimized away, that was "proven" to have no side effects, or is considered "redundant" within what's considered defined behavior. If I write int something(...) { char b[32]; /* ... */ memset(b, 0, sizeof(b)); return 0; } and the compiler optimizes away that memset, because "d'uh", then please tell me.
-
@thatgeoguy@coales.co 2023-11-03 22:10
@thephd@pony.social I need to frame this rant on my desk