No, it isn’t. For your enlightenment: https://www.youtube.com/watch?v=3ar-eJwgTsM
- 0 Posts
- 20 Comments
Processors might no longer get twice as fast every few years, but now we can use the power of servers to write software that runs even slower.
Just use
str::as_ptr()
.Here’s an example (disclaimer: I haven’t used inline asm in rust before, expect issues): https://godbolt.org/z/sczYGe96f
Mostly the missing listing of clobbered registers. Other than that it’s mostly just that you’re doing useless things, like manually putting the stuff into the registers instead of letting the compiler do it, and the useless push and pop. And the loop is obviously not needed and would hurt performance if you do every write like that.
asm!( "syscall", in("rax") 1, in("rdi") 1, in("rsi") text_ptr, in("rdx") text_size, )
(“so many” was inappropriate, sorry.)
Definitely left. Right one won’t be optimized. (And there are
so manysome mistakes in your inline asm…)
And so much more happened: https://en.wikipedia.org/wiki/9_November_in_German_history
Speiser0@feddit.deto Programmer Humor@programming.dev•What's your most obscure binding?105·2 years agoNo way, you met json irl?
Enter NaN. Or else your age is just a number.
The first panel is popular media, not computer scientists.
The computer scientist would write papers about how they adapted principles of the alien technology to our stuff.
Speiser0@feddit.deto Risa@startrek.website•My favorite Enterprise vs Star Wars ship that I've seenEnglish7·2 years agolight to medium intensity combat situations
Are you kidding me? The Enterprise encounters god-like beings on a regular basis, and still manages to subsist after all those episodes, only having lost a very large bunch of its low-ranked crew members. The death star would easily be dealt with in a single episode (but if possible without killing all the people living on the death star, as that would be super cruel).
Does linux have guis at all? I mean it’s just a kernel.
Steps to fix:
- Shut down your pc.
- Install a proper OS, i.e. a linux distribution.
- Be happy.
Real world doesn’t make exceptions. So you’ll get UB.
I like how this depicts how rust is designed more top down and C++ is designed bottom up.
How compiler builders see peppa:
https://www.deviantart.com/ian-exe/art/Peppa-pig-front-face-743773121
I think these two pigs are the best comparison of rust and c++ I’ve ever seen. Also considering the aesthetics, it’s so accurate.
There’s a description field, could people please start putting a link to the original xkcd, i.e. https://xkcd.com/979/ in this case? It’s not that hard.
Without attribution you’re just doing copyright infringement (see also https://xkcd.com/license.html). And you’re hiding useful and nice information like the title text, the title, an the xkcd number, which you can use to get a transcription and an explanation on explainxkcd.
Speiser0@feddit.deto Programmer Humor@programming.dev•0 vs null vs undefined - explained with toilet paperEnglish10·2 years agoI see how you censored at “undefined”. Thanks. The actual value could easily kill anyone who sees it.
Reminds me of https://youshallnotpass.glitch.me/. But this one is even harder. :D
Here’s also a small one about gpus: https://interactive.arm.com/story/the-arm-manga-guide-to-the-mali-gpu
If people want me to write into my code what it does, I guess I’ll label everything:
#include <iostream> #include <cstdint> #pragma GCC diagnostic ignored "-Wunused-label" int main() { A:int a = 4; B:if ((uintptr_t)&a & 0x100) BA:std::cout << "hi" << std::endl; else BB:std::cout << "hello" << std::endl; C:return 0; }
Note that this is much better for code style because - as opposed to the semicolon indentation- the single statement if and else branches still work. The trailing else is on the same line on purpose, it’s so small it doesn’t need its own line. Here’s another style with similar properties:
[[,]]int a = 4; [[,]]if ((uintptr_t)&a & 0x100) [[,,]]std::cout << "hi" << std::endl; else [[,]]std::cout << "hello" << std::endl; [[,]]return 0;
Yes, I’ll name my child parent. This will reverse the tree, vertically.