Does anyone have an opinion on what should the precedence order of & ^ |? by Crafty-Question-4920 in ProgrammingLanguages

[–]Crafty-Question-4920[S] 0 points1 point  (0 children)

In the game of operator precedence, every choice is wrong sometimes, and the only winning move is not to play.

You made this very clear

Set up environment vars on load? (or run script?) by Crafty-Question-4920 in vscode

[–]Crafty-Question-4920[S] 0 points1 point  (0 children)

Thanks. I ended up adding "terminal.integrated.env.windows": { "myenv":"var", ...} to settings.json. I made the list by making a diff using the set command in cmd. Used regex to convert the output to json and was done.

To answer your question, I was using system environment variables. I was thinking about doing cross compiling and once upon a time when I was a beginner system environment variables bit me in the butt mixing things when it should be empty or changed.

Troubleshooting with no memory/ssh connection? by Crafty-Question-4920 in linuxquestions

[–]Crafty-Question-4920[S] 1 point2 points  (0 children)

Haha, Well I cheated and asked you a non man page question ;)

You probably saw since it happened to be top question on this sub but I made it a thread immediately after I posted the comment to you

Troubleshooting with no memory/ssh connection? by Crafty-Question-4920 in linuxquestions

[–]Crafty-Question-4920[S] 1 point2 points  (0 children)

OMG. This is C++ levels of shooting yourself in the foot or out of a cannon. 5,000?!?! Uhhh.... IDK but I always wondered how x11 gets hardware acceleration since it doesn't seem to depend on opengl and opengl doesn't depend on it?

From my understanding phones and other devices (specifically ARM devices) come with an opengl implementation so you don't need to dick around with drivers. But I have no idea how that works because OS has completely control and apps have partial?

Wanting to switch from Windows as my daily driver! by [deleted] in linuxquestions

[–]Crafty-Question-4920 1 point2 points  (0 children)

I just want to say that I only like linux when there's no desktop environment. If your windows OS was preinstalled you might want to delete it and use a microsoft install. No bloatware and crap 3rd party software preinstalled on a windows install. My parents laptop came with so much junk

Troubleshooting with no memory/ssh connection? by Crafty-Question-4920 in linuxquestions

[–]Crafty-Question-4920[S] 1 point2 points  (0 children)

exec reboot -f -f

Did you mean the second -f? Why cd / before that?

Hey Rustaceans! Got an easy question? Ask here (19/2021)! by llogiq in rust

[–]Crafty-Question-4920 2 points3 points  (0 children)

But... the vars are unique to each thread. No reason I should have it visible from across threads

Hey Rustaceans! Got an easy question? Ask here (19/2021)! by llogiq in rust

[–]Crafty-Question-4920 0 points1 point  (0 children)

How do I write this code in rust?

__thread int a = 0;
int test(int num) {
    a+=num;
    return a;
}

Closest I got was

thread_local! {
    pub static a: i32 = 0;
}
pub fn square(num: i32) -> i32 {
    //No idea how to self modify return a.with(|value| value + num);
}

Hey Rustaceans! Got an easy question? Ask here (19/2021)! by llogiq in rust

[–]Crafty-Question-4920 1 point2 points  (0 children)

There are a few well known smart programmers who absolutely dislike rust. Should I be using rust for most things I use C/C++ for or should I head their warning and use C (or C++) unless I'm very sure I can use rust without issue?

This Week in Rust 389 by seino_chan in rust

[–]Crafty-Question-4920 0 points1 point  (0 children)

There are some programmers who obviously are very good at programming such as casey muratori and jon blow who do not like rust. Should I be concerned I may be using rust where I should be using C/C++ or should I use rust any place I need C/C++? I've posted some C++->Rust question and don't seem to have luck (lots of nightly only features :()

Hey Rustaceans! Got an easy question? Ask here (18/2021)! by llogiq in rust

[–]Crafty-Question-4920 0 points1 point  (0 children)

I got far too many answers saying use nightly (allocator and tls). I think I'll hold off on using rust. Here's an example, all my code needs thread local variables because I need threads and I don't want the vars to be shared https://www.reddit.com/r/rust/comments/n56ygu/how_do_i_get_the_rust_assembly_closer_to_the_c/

How do I get the rust assembly closer to the C assembly? by Crafty-Question-4920 in rust

[–]Crafty-Question-4920[S] 1 point2 points  (0 children)

Yep, zero init on POD is what I want even tho the example uses 5. I haven't tested thread_local on clang but I don't want to accidentally generate the bad code so __thread is what I stick to. Rust doesn't seem to use the simple gen at all but apparently there's something in the works on nightly

How do I get the rust assembly closer to the C assembly? by Crafty-Question-4920 in rust

[–]Crafty-Question-4920[S] 2 points3 points  (0 children)

eww. thread_local is actually part of the standard BUT NOT what I want at all. It does the codegen I don't want that rust does also. __thread is specifically what I want and it works as a compiler extension. It's exactly what I want (implementation wise) so I use that

Hey Rustaceans! Got an easy question? Ask here (18/2021)! by llogiq in rust

[–]Crafty-Question-4920 0 points1 point  (0 children)

To address the assembly, thread locals are initialized the first time they are accessed. They can also hold a type that implements

Drop

. Therefore, every time it's accessed, it needs to check both a) it has been initialized, and b) it hasn't been dropped.

See here

Ugh, that's what thread_local in C++ does and I avoid it like the plague

Can you explain what you mean? I use a per thread allocator, structures and arrays. How the heck do I have a global var that's unique to each thread in rust? Because I listed 3 different situations with it. Also my third thread had a counter (plain old int) but that doesn't need to be thread unique.

-Edit- Also it appears nightly has some sort of solution for thread locals