You've misrepresented the situation. Turn up the optimiser to `/O2` and MSVC returns 5 directly, too.
> This function returns 1 if s is "hello". 0 otherwise. I've added a pointless strlen(). It seems like no compiler is clever enough to remove it.
It's funny how sometimes operating at a higher level of abstraction allows the compiler to optimise the code better: https://godbolt.org/z/EYP5764Mv
In this, the string literal "hello" is lowered not merely into a static string, but a handful of integral immediates that are directly inline in the assembly, no label-dereferencing required, and the 'is equal to "hello"' test is cast as the result of some sign extends and a bitwise-xor.
Of course, one could argue that std::string_view::size() is statically available, but then my counter-argument is that C's zero-terminated strings are a massive pessimisation (which is why the compiler couldn't 'see' what we humans can), and should always be avoided.
It seems to me statically checking this should be possible. The liveness of the result of std::vector::front() should be invalidated and be considered dead after the second invocation to push_back(). Then a static analyser would correctly mark the final line with red squiggles. Of course, compilers would still be happy to compile this, which they really ought not to.
> It seems to me statically checking this should be possible.
Statically checking this specific example (or similarly simple examples) could be possible, sure. I'm not so sure about more complex cases, such as opaque functions (whether because the function is literally opaque or because not enough inlining occurred), stored references (e.g., std::span), unintentional mutation of the underlying data structure, etc.
Thats basically one of the main reason Rust's lifetimes exist - to explicitly encode information about when lifetimes are valid in the type system. C++ doesn't have an equivalent (yet?), so unless you're willing to use global analysis an/or non-standard annotations there's only so much static analysis can do.
You absolutely need to pass through a GPU so that DWM.exe is properly accelerated; otherwise, it falls back to the software-accelerated WARP and the performance tanks to ~15 FPS.
It doesn't need to be anything powerful; if you have an idle integrated card that you aren't using on the Linux host because you only interact with it through a Web server or SSH (for instance, Proxmox), then pass that through. It's what I do on my home lab which runs a 9950X.
Before people raise pitchforks against Linux, this applies there, too, for the record: at work I have a Linux instance just to myself that by any other metric is ridiculously powerful: 64-core Epyc, 96 GB memory, but no iGPU, so remote desktop works very poorly.
Also, the last time I checked, many GPUs explicitly detect + block this because they want you to pay for more expensive datacenter versions of the hardware.
A number of intel consumer CPUs support SR-IOV. The iGPU splits out to 7 "virtual functions" or pci devices to map to a VM. On latest Core Ultra's you need a 2x5 model.
My understanding is that it's trivially defeatable by configuring the hypervisor to hide itself (passthrough the real CPUID strings from the processor, ACPI/SMBIOS data/etc), and graphics drivers didn't really put any more effort into detecting beyond that. It's been years since I've been on this scene though, so my info may be out of date.
when did you check last time? I've been using gpu passthrough for more than the last ten years with different gpus from amd to nvidia to onboard intels. last few years I went back to native windows, because some games refused to run in a vm.
We might just replace aeroplanes altogether with ultra-high-speed maglev.
Although the cost calculation for this would be totally different—hundreds of billions up-front for world-crossing tunnels and infrastructure and rolling stock, but then nearly no running cost.
The Chuō Shinkansen will be an interesting small-scale experiment in proper high-speed maglev in regular, long-distance passenger service.
The thing we do technically know how to do just haven't yet because there are no economic incentives to even tackle the finer engineering aspects let alone the regulatory approval ones, is to put a large vacuum-insulated (like a thermos/dewar) liquid hydrogen tank in the middle of a jet or a more-spherical shape front and back of the wing; and then just adjusting the plumbing and combustion chambers and nozzles to work for hydrogen instead of regular diesel-like jet fuel.
We have gas turbines running on hydrogen. They just work. We have tanks like it, just none tuned for the needs and wants of an airplane specifically.
They are more range than a normal jet fuel tank, because hydrogen is just so much lighter per energy.
The only issue is that the insulation needs and the sheer volume make it impractical to keep in regular jetliner wings.
Thus the need for putting a more-spherical tank in the tube shaped fuselage body of the plane.
I think such a plane would be around 5x as expensive today to operate due to fuel costs, and have otherwise pretty comparable performance specs.
There would probably be a separate front and rear cabin, though.
If you tax the CO2 enough you'd trigger such or similar to be put into production.
This comment is proof that the parent commenter has never actually lived in either city.
After a while, a city's 'character', 'charm', and 'charisma' all become annoyances. People live, work, go to school, file taxes, use transport, not just visit tourist attractions. Singapore's quality and efficiency of administration is light-years beyond any other country, perhaps bar Switzerland. 6.1 million people live in Singapore; they're not all multimillionaires.
It's hard to put into words how unsafe Singapore makes me feel.
No, literally, it's hard to put it into words. I feel that if I criticize the country, the govt might take revenge the next time I visit. (See also: Bald JD Vance)
Metrics aren't everything. Singapore might be on paper a great place to live, but it could never be a home.
I agree it's hard to explain why Singapore is so dull. I go there every year or so as that's where the closest Lithuanian embassy is and the entire country feels like a shopping mall.
It's a great example how "on paper" metrics don't match reality but it's hardly surprising given that manipulating paper is the entire function of the country.
Lots of people labouring under weak and old stereotypes here...
I wonder what people would think if I said that about London, if I only visited central London and said 'it feels like a tourist trap'. London is huge, as is Singapore (for a city, it's pretty big— it has a larger population than all of the Baltics and the Nordic except Sweden).
Oh, for goodness' sake, drop the melodrama and hyperbole. I take it you haven't lived in the country either.
Singapore is not North Korea, the PRC, or any of the Gulf countries, where people just get disappeared (or sawn into pieces and stuffed into a suitcase) for 'criticising the government' or 'criticising the country'.
I am Singaporean.
I can absolutely call the ruling People's Action Party a bunch of ivory tower-dwelling bureaucrats who have lost touch with the issues of the populace, and are mostly far cry from Lee Kuan Yew's days. I can say that Ms Josephine Teo really needs to keep her mouth shut, and that Mr Ng Chee Meng, MP for Jalan Kayu, didn't deserve to win his constituency one jot. I can say the ruling party regularly gerrymander the districts so they keep winning, even though they deny it. I can say they stifle the development of creative pursuits and the arts with their heavy-handed censorship. I can say they have their vices backwards by being extremely light on drink-driving, but simultaneously extremely harsh on cannabis, which smells horrible but isn't a big problem in terms of addiction or withdrawal.
I can say they are strongly influenced by Anglospheric right-wing Christian evangelism, and they need to root it out before it settles too deep into the country's psyche. I can say they are trying to build a cult of personality of Lee Kuan Yew, who has been dead for 10 years; it's time the country, the government, and the ruling party built on his legacy and moved forward instead of circling around him and his memory.
If you want more criticism, how about actually watching the Singapore Parliament, and deciding for yourself?
Oh, and if you ever decide to drop by, leave the hard drugs at home (including weed), if you want to leave with your head on its neck.
As for metrics: Singapore is both on paper and in reality a pretty good place to live, if you can stand the humidity and heat (frankly, that's the only truly oppressive thing about the place, how ruddy hot it gets). Why do you think people still emigrate to it, from lower-income countries, and from the West?
And finally, 'bald JD Vance', I don't understand how US politics is related to Singapore. They are countries hemispheres apart. One occupies a full third of a continent and has a population of 350 million. The other is a tiny island city-state of 6 million.
The politics of the US have also degraded to something worse than sports rivalries and the discourse is generally of extremely poor quality; it is only a reflection of the competence (or lack thereof) of its leadership and the majority of its people.
I agree with everything you say, however I would note that Singapore has a substantial resident (ordinary definition of the word) population on various types of work permits who, rightly or wrongly, don't feel so free to speak out as you do.
A substantial proportion of those would like to become PR or even citizens, but can't risk prejudicing an already-opaque process in doing so.
I have a 4K 144 Hz 27-inch monitor I bought in December 2021, and paid nearly $850 for. These monitors still aren't a commodity good, and still end up being pretty expensive.
> want fancy features like autocomplete or structs and functions
I would argue that given a certain ISA, it's probably easier to write an autocomplete extension for assembly targeting that ISA, rather than autocomplete for C, or goodness forbid, C++.
Likewise for structs, functions, jump targets, etc. One could probably set up snippets corresponding to different sorts of conditional execution—loops, if/else/while, switch, etc.
> he only way for the camera to connect to my phone is through some super complicated song and dance, involving my phone requesting a connection over Bluetooth, then the camera running a wifi access point that my phone connects to (during which time my phone disconnects from my home wifi)
Sounds like a Nikon mirrorless. I have a Z6iii, and I am constantly confused with the networking setup. There are something like three duplicated menus, all with very similar functionality.
You've misrepresented the situation. Turn up the optimiser to `/O2` and MSVC returns 5 directly, too.
> This function returns 1 if s is "hello". 0 otherwise. I've added a pointless strlen(). It seems like no compiler is clever enough to remove it.
It's funny how sometimes operating at a higher level of abstraction allows the compiler to optimise the code better: https://godbolt.org/z/EYP5764Mv
In this, the string literal "hello" is lowered not merely into a static string, but a handful of integral immediates that are directly inline in the assembly, no label-dereferencing required, and the 'is equal to "hello"' test is cast as the result of some sign extends and a bitwise-xor.
Of course, one could argue that std::string_view::size() is statically available, but then my counter-argument is that C's zero-terminated strings are a massive pessimisation (which is why the compiler couldn't 'see' what we humans can), and should always be avoided.
reply