by SV_BubbleTime · 6y ago · 0 comments
Websites wouldn’t be 4MB on the front page...
Some of you would be ashamed of the choices you make in typed languages...
Others would be horrified to find out what happens in the back end of not typed languages...
You would constantly find it amazing that single CPU core systems aren’t ever actually doing more than one thing at a time and the concurrency of moving the mouse on the screen and ANYTHING else the system is doing is just an illusion...
You wouldn’t shit on C language... at least less.
... IDK, I’m sure there are a ton more I’m not thinking about. I’ll leave it up to someone else to articulate better... something something FaceTime is usually a massive waste of technology.
These are bad musings from an embedded programmer who is dealing with a 2020 released chip and it’s 4KB of ram.
Nope. If anything, while programming for microcontrollers I learned C is too remote from hardware and leaves too much implementation-defined. Struct padding? Implementation-defined. Bit field implementation? So implementation-defined you'll have to roll your own with shifts and masks. Accessing anything mapped to memory address? The pointers as defined in C standard aren't what you think, but fortunately the implementation often is. Even standard variable sizes are only 21 years old, which means that there is still legacy code that either doesn't use them or wraps them in layers of typedefs to work with toolchains or libraries that don't. And good luck if you have 24-bit registers.
Of course it's frustratingly low level at the same time. I don't know what could be a good choice, and C is what everyone already uses anyway.
You must be much more advanced than I am. Because in 20 years I’ve never had an issue with structure padding because I just assume it pads to n basetypes and pad them manually to 4byte intervals in 32bit.
As to portability, man, you must be moving from ARM to mips to x86 to 8051 to OLD stuff, I’ve never had an issues here either, I just don’t make assumptions of but order if it might matter. Jh mean, code gets tested right? LE to BE or padding or whatever isn’t going to slip by me typically.
The problem with shifts and masks is they don’t typically “automatically” take advantage of the BMF cpu operations like structures definitely will.
IDK, like I said, you must be more advanced than I am. I’ve had none of this issues. Ignorance must be bliss! :)
Anyone who still thinks C is the way computers work is in for a surprise when they realize all modern x86 machines are just emulating x86 in microcode for backward compatibility reasons.
This is very different from how e.g. ARM architectures work.
…they read the standard and are introduced to the C abstract machine, where pointers aren’t integers anymore.
Websites are 4MB because they want a certain experience and a certain functionality, and developers assemble various common components and libraries to achieve this with the least amount of custom development.
A developer knowing assembler will not change the priorities of web site owners.
Any examples?
My app developers came back with a message ID field that uses a UUID. A 256bit store, 16 of my possible 20 bytes.
The whole packet as they designed it was only 6x larger than could possibly fit.
They used int... not having any idea what a int64_t was or that because the value could only ever be 0-20 that a uint8_t was most appropriate. Oh but the language they’re using doesn’t have 8bit ints I guess so then it was a discussion of “what is but shifting” and who even uses this weird operator >> and << !?
I have a hundred examples of the above. Embedded is a different world, I consider that “how computers work” territory.