I thought that was a typo or the forum software removed something, but no - it's a pointer to an empty string literal. If I understand how that works, this creates a null byte (in the read-only memory section of the compiled output?) and points to it. Before this line it checks if p is NULL.
I wonder what is the advantage of doing this? Maybe to make sure that p is an actual pointer, so later code can just make that assumption.
lokar 8 hours ago [-]
Yeah, it simplifies later code, and is safer in the face of future changes.
Or put another way, it tightens the API/contract of that chunk of code to always return a valid string.
lioeters 7 hours ago [-]
That makes sense, with that "guard" at the top, the rest of the function can return the pointer anywhere. And I imagine the compiler will ensure the empty string literal is created only once. Good to know!
phplovesong 8 hours ago [-]
I had high hopes for Bun, but looks like it has gone down the shitter after they went all in on vibecoding.
loevborg 5 hours ago [-]
This was pre-Anthropic but the fact that Bun automatically loads .env files if they're present almost disqualifies it from most tasks https://github.com/oven-sh/bun/issues/23967
It makes it hard to take them too seriously with such a design choice - a footgun really. It's so easy to accidentally load secrets via environment variables, with no way to disable this anti-feature.
rvz 46 minutes ago [-]
Damn. That one is absolutely horrific.
What a find.
hu3 4 hours ago [-]
I still have high praises since one of my clients use it in production.
I personally use it's tooling part which is screamingly fast.
gear54rus 6 hours ago [-]
Any specific links to problems? I was planning to start a new project on it :(
pjmlp 6 hours ago [-]
Anthropic acquisition, what do you expect as outcome?
gear54rus 4 hours ago [-]
Best case is they throw their endless amount of paper at it without touching it. At least something useful comes out of this AI crap then. One can dream.
pier25 6 hours ago [-]
it's been flawless for me
embedding-shape 2 hours ago [-]
That's maybe more worrisome, everything has tradeoffs, if you don't know them yet, search for them :)
WTF is just kinda funny. Seen it used in loggers too log.wtf("this should never happen")
yikes
I wonder what is the advantage of doing this? Maybe to make sure that p is an actual pointer, so later code can just make that assumption.
Or put another way, it tightens the API/contract of that chunk of code to always return a valid string.
It makes it hard to take them too seriously with such a design choice - a footgun really. It's so easy to accidentally load secrets via environment variables, with no way to disable this anti-feature.
What a find.
I personally use it's tooling part which is screamingly fast.