5 ms·
> For this we need a certain old, but little-known feature of UNIX linkers STOP WRITING NON-PORTABLE CODE YOU BASTARDS. The correct answer is, as always, “sto
by forrestthewoods 1y ago
> For this we need a certain old, but little-known feature of UNIX linkers
STOP WRITING NON-PORTABLE CODE YOU BASTARDS.
The correct answer is, as always, “stop using mutable global variables you bastard”.
Signed: someone who is endlessly annoyed with people who incorrectly think Unix is the only platform their code will run on. Write standard C/C++ that doesn’t rely on obscure tricks. Your co-workers will hate you less.
- spauldo 1y agoI tell my coworkers, "Hey, we need this coded up as a Windows service!" and I get crickets. So I spin up a Debian VM and POSIX the hell out of it. If they dare to complain, I tell 'em to do their damn jobs and not leave all the hard stuff to the guy that only programs on UNIX.
- forrestthewoods 1y agoTheir tasks would be less hard if the UNIX guy would stop writing non-portable POSIX code =P
- spauldo 1y agoThat's what I know. I wasn't hired to program Windows machines, I was hired to program PLCs and SCADA systems. But every now and then something best done in .NET comes up and none of the Windows guys can get off their butts to do it. So then they get to whine about having to deal with Linux and I get to tell them to suck it up. Sure, I could learn to program on Windows... Or I could pick up another PLC or SCADA platform that looks good on my resume. Guess which I choose to do?
- forrestthewoods 1y agoI have nothing to nice to say in response. Good luck!
- wasmperson 1y agoTo be fair to your coworkers, coding a windows service and setting up logging for it is surprisingly complicated. I'm the only person at my place of work that can do it, and even then only if I can use a compile-to-native language or .NET.
- jojobas 1y agoEvery time someone ships successful code that's hard to port to Windows the world becomes a better place.
- delta_p_delta_x 1y ago> Every time someone ships successful code that's hard to port to Windows Until your boss tells you to port your so-far Linux-only code to Windows, and you run that struggle. Signed, someone who spent the past year or so porting Linux code to Windows and macOS because the business direction changed and the company saw what was the money-maker. P.S. Not the parent commenter, because I just realised they, too, had a paragraph beginning with 'signed, ...'
- jojobas 1y agoLooks like you're complaining about too much job security. Also it's you choice to accept that task and make the world a slightly worse place again.
- 1718627440 1y agoCan you setup Windows to install WSL if it isn't there yet and then set it up, in a Windows installer?
- forrestthewoods 1y agoForcing Windows users to use WSL is generally a non-starter. That’s just not how things work. You can force someone to change their entire execution environment without further consequences. If you only support WSL then you don’t support Windows, imho.
- 1718627440 1y agoI see were you are coming from, but programs also depend on an SQL server, a python installation or a Java instance. You also don't complain about device drivers, support for filesystems, the network stack and hooks to Windows Explorer. In the end it is just part of the OS and a bunch of extra userspace programs. I mean nobody complains about the Windows Subsystem for Win32. But yeah, you can just use a non-MS GNU/Windows implementation instead, do you like that better? Is it possible though? Is it possible to have isolated WSLs (per programm)?
- ndanilov 1y agoAuthor here. This is part of SPDK-based server code. Transportability outside of UNIX (mostly Linux) is entirely irrelevant. By the way, the global variables here are immutable after the initialisation, that's the point.
- menaerus 1y agoUnless you missed it from another comment in this thread, the optimization you made is based on a wrong assumption and misreading the asm code: "je .L3" will skip all the costs you consider.