Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
aartaka
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
5 ms
·
61.
▲
by
aartaka
2y ago
It's a set of C Preprocessor macros, so you don't even need to somehow process the code—you just #include the header and hack away as if it was regular C!
62.
▲
by
aartaka
2y ago
Indeed, I might need to revisit foreach with type inference. Should be totally possible.
63.
▲
by
aartaka
2y ago
Yes, it's one of the inspirations!
64.
▲
by
aartaka
2y ago
You might like https://aartaka.me/oop-c
65.
▲
by
aartaka
2y ago
With C23 (nullptr, auto typing, typeof) and C11 (generics) it got more guarantees and type-related primitives. You can still do void*, but you are strongly discouraged from it.
66.
▲
by
aartaka
2y ago
Thanks!
67.
▲
by
aartaka
2y ago
You're welcome!
68.
▲
by
aartaka
2y ago
C17 doesn't have auto, but C23 does, and thus my `__STDC_VERSION__ > 201710L` (notice the greater than sign, it doesn't include C17 itself.)
69.
▲
by
aartaka
2y ago
I won't stop you, so be my guest.
70.
▲
by
aartaka
2y ago
Yeah, I love sugar ;)
71.
▲
by
aartaka
2y ago
Thanks!
72.
▲
by
aartaka
2y ago
Author here. I'll be glad to accept any contribution that makes C more readable, so PR away!
73.
▲
by
aartaka
2y ago
Can't wait to learn of how it went!
74.
▲
by
aartaka
2y ago
Well, you don't have to use it all. My projects mostly use booleans, len(), max/min, and some operator aliases, because there wasn't much need for other tasty stuff yet. So give it a shot, even if for a couple of operator mac
75.
▲
by
aartaka
2y ago
Thanks!
76.
▲
by
aartaka
2y ago
Yes, LOOP is a huge inspiration and my favorite programming language!
77.
▲
by
aartaka
2y ago
Thanks!
78.
▲
by
aartaka
2y ago
Thanks!
79.
▲
by
aartaka
2y ago
Will do.
80.
▲
by
aartaka
2y ago
Indeed, FLT_EPSILON is not a one-size-fits-all solution, but it's good enough for frequent case of comparing big enough numbers, which is not covered by regular ==. So it's a convenience/correctness trade-off I'm ready t
81.
▲
by
aartaka
2y ago
Yes, and it's a shame that underlying features were only shipped in C11 (generics) and C23 (auto type inference!)
82.
▲
by
aartaka
2y ago
Scoping defer to a block is actually more useful and explicit than function-exclusive that Go does, so I consider that a feature.
83.
▲
by
aartaka
2y ago
You're welcome!
84.
▲
by
aartaka
2y ago
Author here. I don't see any problem with this
85.
▲
by
aartaka
2y ago
Yes, code blocks in Org are executable, but I was aiming for simple embedding and zero build-time, thus conservative choice of separating README and the actual header.
86.
▲
by
aartaka
2y ago
Added in commit ef510ca!
87.
▲
by
aartaka
2y ago
"loop" added in commit 626408b, thank you!
88.
▲
by
aartaka
2y ago
Pretty C does aliases "repeat" for "do", so yeah, I've got you covered!
89.
▲
by
aartaka
2y ago
"forever" added in commit 67ff9ef, thank you!
90.
▲
by
aartaka
2y ago
Indeed! But I've reserved "unless" for a ternary conditional, which is more useful anyway. Oh shit wait, you're John Tromp, BLC creator! I'm a fan!
More ›