Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
lerno
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
10 ms
·
151.
▲
by
lerno
1y ago
Oh `.elements` would you believe that this is a remnant of C2's builtin function `elemsof`? Its used so rarely (I think two uses in the entire stdlib), so it hasn't come up. I opened an issue for it: https://github.com&
152.
▲
by
lerno
1y ago
I always find this opinion intriguing, where it's apparently fine that globals are initialized to zero, but you are INSANE to suggest it's the default for locals. What kind of programs are y'all writing? Clearly the lack of z
153.
▲
by
lerno
1y ago
Out of C3, Odin and Zig, Zig is actually the language with the worst SIMD support. Odin has SIMD vectors, array programming and built in matrix types while C3 has built in SIMD vector types and operator overloading for userland numerical ty
154.
▲
by
lerno
1y ago
C gives either, I think that is the true with Odin as well, it certainly is for C3. I was assuming Zig allowed both. Is this another one of Zig being strict with ”only one way”?
155.
▲
by
lerno
1y ago
The ease of using Odin over Zig for Raylib was an interesting contrast that I hadn’t reflected on myself. I tried to do things well with C3, but it might be hard to beat Odin on that particular point. I just wonder how well it will work lon
156.
▲
by
lerno
1y ago
Yes, I am quite aware. But it doesn’t make D any less a C++ alternative.
157.
▲
by
lerno
1y ago
It was introduced in 2017, and not part of the original direction of D (it’s neither in 1.0 nor the 2.0 revision of the language) That D exposes a curated subset of D doesn’t make it a C alternative, even though the ”betterC” aims to target
158.
▲
by
lerno
1y ago
In any case this seems to be part of some series on Zig, so the title is misleading: it sounds like it’s a blog post talking about memory safety in zig, but it’s just about features in Zig that can make it a little more safe.
159.
▲
by
lerno
1y ago
What does the AI detection sites say?
160.
▲
by
lerno
1y ago
Isn't all sorts of stuff metaprogramming in Zig? Generic types, vtable interfaces, printf. All use comptime to generate code.
161.
▲
by
lerno
1y ago
D was never a C alternative, it was a C++ alternative.
162.
▲
by
lerno
1y ago
I think the Zig community should worry more about when Jai is released. Esp given that Zig isn’t anywhere near 1.0 yet, and feature wise it’s a rather sparse language that has first mover advantage over alternatives, but as a language it ac
163.
▲
by
lerno
2y ago
A stack allocator is an allocator that aside from allocate, has a push and a pop function. Image an arena allocator (aka bump allocator), where ”push” stores the current start of free memory, and ”pop” resets to this point, erasing all allo
164.
▲
by
lerno
2y ago
No, not alloca , I mean a stack allocator as you push / pop memory scopes. The trailing body macro is something I think you should try out before dismissing it. It's similar to how Ruby can do it, with the closures exiting the &q
165.
▲
by
lerno
2y ago
BTW decimal fixed point or binary fixed point?
166.
▲
by
lerno
2y ago
In C casting a pointer to an int and back again used to be fine. Except later people want to track the pointer to do optimizations and things went... poorly. I feel that this is a mess better addressed once there are actual implementations
167.
▲
by
lerno
2y ago
I haven't used Nim enough to write a good comparison. I am not mentioning Crystal either. If someone wants to contribute a comparison I'd be happy to feature it. It is supposed to be fair and simply outline the differences in feat
168.
▲
by
lerno
2y ago
I think that one is a bit wrong, I must have written it many years ago. There are machines where pointers do have different address spaces, like the Arduino obviously, but that support isn't in the language yet, and maybe there might b
169.
▲
by
lerno
2y ago
Well, it's not that difficult to get into the Jai beta if you are building something with Jai I think? I seem to recall that Jon just asked beta testers that they actually have a project that they will use it for?
170.
▲
by
lerno
2y ago
Not a C fan then ;)
171.
▲
by
lerno
2y ago
The temp allocator is a stack allocator, so it's a bit more flexible than that and can be used for return values or even more long lived allocations. It doesn't use the standard heap allocator to alloc, so there is a potential win
172.
▲
by
lerno
2y ago
Yes both are implemented as attributes `@weak` and `@init` respectively.
173.
▲
by
lerno
2y ago
Well, you're free to revive this issue: https://github.com/c3lang/c3c/issues/1451 . I'd need a more solid proposal.
174.
▲
by
lerno
2y ago
That one was missing a comma: "I know, it's hard". I'll do my best.
175.
▲
by
lerno
2y ago
I don't have any particularly strong stance on provenance. But I've yet to see a strong argument for it in C. There is not much of a guide I'm afraid. I translated some of the raylib examples to C3: https://github.
176.
▲
by
lerno
2y ago
Personally I think it is reasonable that a C alternative is an alternative to C, and not a C++ alternative. C3 uses a temp allocator that removes a large number of cases where C++ would need RAII to manage memory. Did you try C3?
177.
▲
by
lerno
2y ago
You could still do it as a userland feature and implement add/sub/mult/div as methods on the type.
178.
▲
by
lerno
2y ago
I tried to answer that here: https://c3.handmade.network/blog/p/8886-why_does_c3_use_%252...
179.
▲
by
lerno
2y ago
No, there is an incomplete proposal for it here though: https://github.com/c3lang/c3c/issues/1451 What would you like to use it for?
180.
▲
by
lerno
2y ago
I know it’s hard.
More ›