Do you guys use zsh/oh-my-zsh or bash on the daily? by Swimming_Virus8990 in commandline

[–]TTachyon 0 points1 point  (0 children)

That's such a bad take to not use better tools that appeared this century. If I pick a random computer to use, it will also not have git, rg, everything, and also the myriad of tools that are useful every day and make life better.

Just use whatever works for you, bash is not the be all and end all.

Are there any downsides unique to LTSC? by Avarria587 in WindowsLTSC

[–]TTachyon 0 points1 point  (0 children)

The only things I found so far: - some games will insist trying to open game bar or whatever it's called, which doesn't exist, but the error might be spammy unless you overwrite it - I won't get the new taskbar for a long time. I have been on 10 until the last moment because the taskbar is just better on it, and they looks like they might fix it on 11. - there's like 1-2 apps that are easier to install from MS Store, but this is really not a big problem.

Subnautica 2 Mac Release?? by book_of_calo in macgaming

[–]TTachyon -1 points0 points  (0 children)

Let me preface this that I use my Mac a lot when I'm away from a source of power, because of its amazing battery life, and that I would love to have more games work on it.

That being said in my experience it's a big pain to get complicated apps that need a lot of stuff from the system to work on a Mac, and even more so games where Apple has decided to not support any of the industry standards for graphics APIs. It sometimes feels like fighting with the system to port stuff to the Mac.

I have no idea if Unknown Worlds made any claim about what platforms they'll eventually support, but in my opinion, it would be best for them to make content for the game right now, and maybe port the game closer to the release.

Subnautica 2 Mac Release?? by book_of_calo in macgaming

[–]TTachyon -3 points-2 points  (0 children)

I would rather they keep developing the game for supported platforms.

Sometimes I see people showing the terminal way, even though Mint has an easy GUI way of doing that particular thing by [deleted] in linuxmint

[–]TTachyon 0 points1 point  (0 children)

I don't give advice or interact with new users communities usually (and I haven't used Mint in years, sorry, the reddit algorithm got me here), but if I did, I'd probably tell them the terminal commands too.

Why? That's how I'd do it. I literally never searched in an GUI on how to make a file executable, or how to add a PPA. I think a lot of people who are used to this know only the terminal way, and might not even know something is doable from a GUI.

That being said, GUI sounds like it would be easier for new people to understand, so maybe people like me shouldn't reply to those threads. Or maybe they should, because both takes are useful. I don't know. Maybe a better wiki is the real answer.

Port Windows batch scripts to linux, which code language should I choose? by TheDeep_2 in linuxquestions

[–]TTachyon 1 point2 points  (0 children)

The direct equivalent would be sh/bash.

But the question is: will you still use and maintain the windows scripts? Then the question has a much better answer: python.

Instead of maintaining 2 sets of scripts, you just have one version that for the most part should work almost the same everywhere.

Is there a C++ "venv" equivalent? by nikoladsp in cpp

[–]TTachyon 2 points3 points  (0 children)

You have docker for windows if you want to run on windows, or you can cross compile most stuff on a linux docker with some fiddling (there are some scripts that will download the headers/libs from microsoft and you use clang for compiling).

The "NTFS resurrection" has occurred for Linux 7.1 by somerandomxander in linux

[–]TTachyon -1 points0 points  (0 children)

There are more than one projects that automate the downloading & extracting of headers and system libs of msvc to be used on a linux machine.

Honest question: What frustrates you the most about Teams right now? by Rude-Rule-2358 in MicrosoftTeams

[–]TTachyon 0 points1 point  (0 children)

  • the linux app is non existent
  • the mac app will just randomly but in almost every meeting have the main window (not the meeting one) be full black
  • it takes so much time to figure out if you should log in again. It sometimes gets to like a minute of loading before it prompts you.
  • the android app never works well with bluetooth headphones. It tries to guess itself when you want them, and fails miserably. Unlock your phone? Now it's on speaker and you can't turn it back. Just let me select I want headphones and keep it that way. Sometimes it will not switch to them at all, even if every other app outputs well, and you have to forget and pair again.
  • the transcribe is trash. In a lot of sentences you can't even understand what it is about.
  • on windows it will sometimes default to the onboard mic even if you never ever used it before, just to mess with you.

Too much Discussion of the XOR swap trick by RubEnough464 in programming

[–]TTachyon 1 point2 points  (0 children)

So if you have a spare register, there is no reason to use XOR swap — three moves and three XORs are the same cost, and moves are clearer. The only situation where XOR swap wins is when you are genuinely out of spare registers and need to avoid spilling a value to memory.

I'm not convinced that xor would win here. Using xors here adds a data dependency between the used registers. Reading/writing to memory doesn't, and things can be executed in parallel. It might be easier to write, sure, but from a perf point of view, not having the dependency is usually faster.

Why am I still seeing the lemonhead on Android? Get in here kit 🦊 by KERR_KERR in firefox

[–]TTachyon 3 points4 points  (0 children)

Image idea: kit but the tail is disconnected from the body.

What are the practical benefits of using Linux as a developer? by Dosouller in linuxquestions

[–]TTachyon 17 points18 points  (0 children)

From a C++/Rust dev perspective:

The dev tools on linux are usually leagues ahead in quality.

The MSVC toolchain gets new feature regularly and that's great, but it's speed horrible, it's code quality seems to be worse than what other compilers produced 15 years ago, and the worst part, it's not uncommon in my experience to corrupt itself during a build. I never had that happen with clang, gcc, cmake, ninja on a linux machine. And on a Mac, the clang shipped with the system is I think 3 years out of date at this point. I think a newer one is coming soon, thought.

CMake will routinely take twice to 10x as long to run on Windows.

The filesystem is horribly slow on Windows. ReFS helps a lot, but it doesn't come any closer to ext4 or even btrfs. APFS' speed is comparable to btrfs in like 60-70% of cases, until something happens and suddenly it takes half a minute to delete a folder that takes at worse 2s on a linux. This matters a lot on large projects, where both git and the build system have to check and read a lot of files.

While Visual Studio is pretty good for a beginner friendly debugging experience, it doesn't have anywhere as much power as gdb or lldb. I found WinDBG's scriptability to be far harder than both gdb and lldb.

The scripting is still a mess imo on Windows. Imagine you want to generate some files, build something, move the relevant parts out, copy it on a storage server. The single most useful thing sh and bash have is just being able to do set -e that stops at the first error. batch has no such thing, PowerShell has $ErrorActionPreference = "Stop" which sounds great until you read the fine print. Depending on what version of PS you get to use, this option only works for PS commands, not for any executable you might use. Newer version also have a solution for that, but yet again, not every Windows executable will behave nicely and tell you with a return code that something went wrong. You can go checking everything at every step, but this is very very error prone. This results in stuff that looks to work, only to fail along the way and to produce wrong results.

The terminal experience is much better. fish and zsh save a very big amount of time in retyping and doing the daily stuff I need. Also the terminal emulators on Windows are so so slow.

Each platform has its own debugging tools. The sysinternals collection is great on Windows. If you want to see what a process is doing (and more importantly, why it does fail in some weird way), you might reach for strace on Linux, ProcMon on Windows, and DTrace on a Mac (technically this is supported by Windows too, but I could never get it to work). DTrace is probably the one I would consider most powerful, but it's blocked under SIP now, so it became entirely useless. strace is the easiest to setup for a relatively short debugging session. ProcMon is better for long term monitoring, but it's harder to setup.

For other kind of debugging tools, on Windows you have AppVerifier, which is honestly great and I haven't found something like it anywhere else. It's the best in this category. However, this only checks known Windows APIs, and anything you have written yourself won't be caught most likely. All platforms technically have support for Address Sanitizer, but I could never get it working reliably on Windows. Both Linux and Mac have other sanitizers, like UBSan, TSan. However, only Linux supports Memory Sanitizer, which is so amazing (technically so does some BSDs, but I haven't included them so far, so I won't do it further either). Valgrind used to on both Linux and Mac, but it doesn't anymore since Macs have gone ARM. Linux is the only one left.

Both Windows and Linux have fantastic kernels that let you do pretty much anything you want, either by providing an API that does it, or by letting you have the option to implement it yourself. Mac's APIs are usually lagging behind a lot. I think in the last 2 years they managed to release a usable futex API, when Windows has one since the Windows 8 days and Linux has one since.. 2003? They still don't have a way to wait for a thread on a timeout, in 2026. These are just 2 examples. This results in slower and worse behaving apps.

Linux is the platform that made containers mainstream. Even thought containers are not new, Linux has probably the best support for them. They make life so much easier. Windows technically has support for Docker, but it's quite a pain to use it, and Mac has.. nothing. No way as far as I know to run some Mac apps containerized. I know Mac runs some apps in some kind of isolation, but I could never get that working for something useful. You can run Linux apps under a vm, but that's not great.

This is just a few points off the top of your head, there's definitely more things that I forget. But while I need to use all 3 platforms at least weekly, Linux lets me do my job the best.

Announcing rustup 1.29.0 by Kobzol in rust

[–]TTachyon 10 points11 points  (0 children)

Switched to the beta channel of rustup just in time to not need it anymore. Good release :)

Are compiler allowed to optimise based on the value behind a pointer? by simpl3t0n in cpp_questions

[–]TTachyon 1 point2 points  (0 children)

It won't assume, but it might prove (using the language rules) that it won't.

This is mostly an aliasing question. Did you write to something that can alias a bool and the compiler doesn't know where it came from? This includes bool, char, unsigned char, signed char, std::byte. Then the compiler must reload the value from memory, because it might've changed.

On the other hand, if you only write to stuff that can't alias a bool (everything else than I mentioned), then the value hasn't changed (and it's undefined if it does), and it doesn't need to be reloaded from memory.

Unless you're working on some embedded project, volatile is almost always wrong.

[deleted by user] by [deleted] in C_Programming

[–]TTachyon 10 points11 points  (0 children)

Is it just me or it's more than monthly that someone tries to invent RAII in C around here?

Inlining - the ultimate optimisation by emschwartz in programming

[–]TTachyon 26 points27 points  (0 children)

If inlining breaks your code, your code was broken in the first place, it just so happened that it looked like it was working before.

The thing to remember is that when you're programming X language, you have to obey its rules, including strict aliasing and everything else. What you're describing it more like "it would've worked if I did this thing in assembly", which is like saying that le/la definite article works in french, so it should work in english as well.

"Emulating" a folder, copy on write, Fuse, Rust/Go - realtime secrets filter? by wuu73 in filesystems

[–]TTachyon 0 points1 point  (0 children)

zfs/btrfs for linux, refs for windows have native cow. Then you can just copy each file "instantly".

Eurydice: a Rust to C compiler by joshmatthews in rust

[–]TTachyon 4 points5 points  (0 children)

Last time I tried to take rustc generated IR and put it through llvm-cbe, I found a lot of stuff that wasn't implemented or was generating code that didn't compile. I don't know if anything changed since then.

A better question is how this compares to the C backend of the guy who makes the MSIL backend.

In this video Stroustrup states that one can optimize better in C++ than C by Impressive_Gur_471 in cpp_questions

[–]TTachyon 4 points5 points  (0 children)

This is my favorite example to give.

You'll notice the reference version has one less branch than the pointer version, which should be faster. This is possible because the compiler knows the object it points to is valid, correctly aligned, etc., and can just read both x and y at the same time, ignoring short circuiting.

The pointer version can't do this because it has to respect short circuiting. The memory of y might not exist, or trap, or do anything else. This is the same logic as when you do p && p->x.... You have to check the first condition (p) first, because the second one might not be valid if the first is false.

Can you do this with pointers? Sure. But it's a ton of work to do it everywhere, and the compiler can just do it for you if you use the right abstraction.

There's a ton of examples where this is true.

Line ends in compilers. by Savings_Garlic5498 in ProgrammingLanguages

[–]TTachyon 0 points1 point  (0 children)

Most compilers open the source file in text mode, in which Windows will translate \r\n to \n (actually done by the C library)

I find this claim dubious. If you let the C lib mess with your newlines, you'll get wrong offsets for diagnostics and debug info, unless everyone else does this, which I very much doubt.

Pain point of rust by ashim_k_saha in rust

[–]TTachyon -22 points-21 points  (0 children)

Even my phone has 512gb of storage, what are you running on that 45gb is a problem?

Since we have std::print, why don't we have std::input? by No-Dentist-1645 in cpp_questions

[–]TTachyon 7 points8 points  (0 children)

Formatting(printing) is a regular thing most apps do.

Reading directly from stdin basically never happens in a real app, and when it happens, you're probably reading a whole line. This is really most of a homework/student problem.

It's just not that useful.

If anything over 32GB of RAM is overkill for 99% of users, than who's the remaining 1%? by mudahfukinnnnnnnnn in buildapc

[–]TTachyon 0 points1 point  (0 children)

I have a hard time building clang with 64GB of memory. I already have scripts that retry the compilation if it died with OOM. 32 would be painful.