Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
I think you've just realized that in low level languages in the end everything is just a bunch of bytes.
-
wowotek58165y@gronostaj i learn x86 long time ago but i wondering how did the prog. lang. Know if it's a zero or a null.
-
@wowotek The same way that it knows if 0x61 is decimal 97 or letter "a": typing. You told it what type it is when declaring or assigning it.
-
wowotek58165y@gronostaj ah so that why there is a static typing and dynamic typing. So in some point the prog lang just track the value so output what it expect?
-
@wowotek Yup. And in some languages, like C for example, you can abuse it and for example change "a" into "A" by subtracting 0x20.
-
wowotek58165y@gronostaj ooo neat 🤣 never realized that thanks. But are you sure it was 0x20?
Edit: yes its 0x20 it was a hex not decimal lmao -
@wowotek Unix (and, by extension, Linux) expects the application programmer to be competent, and provides much less information as a system (because elegant simplicity and such).
-
@wowotek I can give you an example: Option in Rust (which either stores a value or nothing, null in a sense) stores an additional flag that tells it whether it has a value or not. (It really stores an enum discriminator because it's an enum, but same logic)
-
Hazarth95215y@Haxk20 my best C abuse was summing integers parallely on a single CPU process by treating a single 64 bit long pointer as two 32bit pointers. But adding it as longs. As long as you dont overflow it works, I benchmarked it and its 2x as fast, you can go further and sum 4 16-bit shorts and even 8 8-bit bytes... But with those overflows become more of a problem and additionall logic to prevent them eats up cycles
Shower thoughts: i wondering something silly, for example address 0xf006 points to address 0xf003 which has value of 0x0000 how did it know if it is a 0 or a NULL
question