Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
aw1621107
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
9 ms
·
151.
▲
by
aw1621107
7mo ago
> With expression templates you can translate one to the other, this is a static manipulation that does not depend on compiler level. How does that work on an implementation level? First thing that comes to mind is specialization, but I
152.
▲
by
aw1621107
7mo ago
> If you have a genuine question you should ask one but please do not disguise so that it only goes to prove your point. I think my question is pretty simple: "How does an optimizer-independent expression template implementation wor
153.
▲
by
aw1621107
7mo ago
> The example is false because that's not how you would write an expression template for given computation OK, so how would you write an expression template for the given computation, then? > Expression templates do not rely on O
154.
▲
by
aw1621107
7mo ago
> What nasal demons? Those that result from the pre-C++26 behavior where use of an indeterminate value is UB. > But there’s lots of room between deterministic values and UB. That's a fair point. I do think I made a mistake in how
155.
▲
by
aw1621107
7mo ago
> since you're not dealing with the computations directly but rather expressions (nodes) through which you are deferring the computation part until the very last moment (when you have a fully built an expression of expressions, basi
156.
▲
by
aw1621107
7mo ago
They are both; there are things that Rust's macros can do metaprogramming-wise that C++ templates cannot do and vice-versa. Rust's macros work on a syntactic level, so they are more powerful in that they can work with "normal
157.
▲
by
aw1621107
7mo ago
I had always thought expression templates at the very least needed the optimizer to inline/flatten the tree of function calls that are built up. For instance, for something like x + y * z I'd expect an expression template type lik
158.
▲
by
aw1621107
7mo ago
> Rust cannot take a const function and evaluate that into the argument of a const generic Assuming I'm interpreting what you're saying here correctly, this seems wrong? For example, this compiles [0]: const fn foo(n: usi
159.
▲
by
aw1621107
7mo ago
> For example you cannot design something that comes evwn close to expression templates libraries. You keep saying this and it's still wrong. Rust is quite capable of expression templates, as its iterator adapters prove. What it isn
160.
▲
by
aw1621107
7mo ago
> C++26 adds destructive moves. They are called relocatable types. I thought those were removed? For example, see Herb's 2025-11/Kona trip report [0]: > For trivial relocatability, we found a showstopper bug that the group d
161.
▲
by
aw1621107
7mo ago
> Let's say I'm the implementation. If I go get fresh (but not zeroed) memory from the OS to put my stack on, the garbage in there isn't state of the program, right? I'd argue that once you get the memory it's no
162.
▲
by
aw1621107
7mo ago
> It says the value is unspecified but it exists. The precise value is not specified, but whatever value is picked also has to be something that isn't tied to the state of the program so some kind of initialization needs to take p
163.
▲
by
aw1621107
7mo ago
For what it's worth, there's this bit from the parallel-hashmap readme: > We encourage phmap users to switch to gtl if possible. gtl provides the same functionality as this repository, but requires C++20 or above. And the bench
164.
▲
by
aw1621107
7mo ago
> there is 30 years of C++ in the real world, initializing everything by default unless you opt-in will break some performance critical code that should not initialize everything ...But the change to EB in this case does initialize eve
165.
▲
by
aw1621107
7mo ago
> It can. What suggests it wouldn't be able to? "Whatever value was in memory" would be depending on the (former?) state of the program, wouldn't it?
166.
▲
by
aw1621107
7mo ago
> What does “independently” mean? It means what it says on the tin. Whatever value ends up being used must not depend on the state of the program. > Are we talking about all zeros? All zeros is an option, but the intent is to allow th
167.
▲
by
aw1621107
7mo ago
No, in general Rust doesn't (and can't) know whether an arbitrary function has side effects. The compiler does arguably have a leg up since Rust code is typically all built from source, but there's still things like FFI that
168.
▲
by
aw1621107
7mo ago
> The compiler cannot remove or reorder instructions that have a visible effect. You might be surprised! When it comes to UB compilers can and do reorder/eliminate instructions with side effects, resulting in "time travel"
169.
▲
by
aw1621107
7mo ago
> because even though assert terminates the program, the C++ compiler cannot see that I think it should be able to. I'm pretty sure assert is defined to call abort when triggered and abort is tagged with [[noreturn]], so the compile
170.
▲
by
aw1621107
7mo ago
Shouldn't control flow diverge if the assert is triggered when NDEBUG is not defined? Pretty sure assert is defined to call abort when triggered and that is tagged [[noreturn]].
171.
▲
by
aw1621107
7mo ago
> The problem is the code unconditionally dereferences the pointer, which would be UB if it was a null pointer. Only when NDEBUG is defined, right?
172.
▲
Understanding Safety Levels in Physical Units Libraries
(mpusz.github.io)
4 points
by
aw1621107
7mo ago
|
0 comments
173.
▲
No Semicolons Needed
(terts.dev)
17 points
by
aw1621107
7mo ago
|
8 comments
174.
▲
by
aw1621107
7mo ago
> I'm assuming the suns gravity simply cant move objects of such different mass, at the same rate, and thereby the orbit and position changes accordingly? Kind of? An object moving in a circular motion at a constant speed must have
175.
▲
by
aw1621107
7mo ago
> I mean the exact identical orbit, the exact path that earth takes around the sun -> ahead (or behind, it does not matter) of where we are and instead of 365 days to circle the sun, the asteroid is moving at a rate that will take MOR
176.
▲
by
aw1621107
7mo ago
> I would sit in a lunar orbit Ah, so by "orbit" you were talking about orbit around Earth specifically? > why cant I just throw a tow strap on that, accelerate, and park it an area that only has to be accurate enough for a
177.
▲
by
aw1621107
7mo ago
> Space Stations are in orbit - the space battleship doesn't have to be I mean, you did say: > space battleship - one that never comes down to the surface, just sits in orbit. So I think it's understandable for people to t
178.
▲
by
aw1621107
8mo ago
Sure, but those are arguably more like implementation details as far as end users are concerned, aren't they? At least off the top of my head I'd imagine tokio would require Send + Sync for tasks due to its work-stealing architect
179.
▲
by
aw1621107
8mo ago
I guess the no_std/alloc/std split is sort of like what you're talking about? It's not an exact match though; I think that split is more borne out of the lack of built-in support some targets have for particular features
180.
▲
by
aw1621107
8mo ago
> Could you share a situation where the behavior is necessary? The effects mentioned in the article are not too uncommon in embedded systems, particularly if they are subject to more stringent standards (e.g., hard realtime, safety-criti
More ›