frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Mobile carriers can get your GPS location

https://an.dywa.ng/carrier-gnss.html
234•cbeuw•3h ago•144 comments

Genode OS is a tool kit for building highly secure special-purpose OS

https://genode.org/about/index
70•doener•2h ago•5 comments

Demystifying ARM SME to Optimize General Matrix Multiplications

https://arxiv.org/abs/2512.21473
9•matt_d•41m ago•0 comments

The Saddest Moment (2013) [pdf]

https://www.usenix.org/system/files/login-logout_1305_mickens.pdf
6•tosh•44m ago•0 comments

US has investigated claims WhatsApp chats aren't private

https://www.bloomberg.com/news/articles/2026-01-29/us-has-investigated-claims-that-whatsapp-chats...
39•1vuio0pswjnm7•3h ago•203 comments

Claude Code is your customer

https://calebjohn.xyz/blog/b2cc/
10•mfbx9da4•4d ago•0 comments

CPython Internals Explained

https://github.com/zpoint/CPython-Internals
112•yufiz•4d ago•27 comments

Finland to end "uncontrolled human experiment" with ban on youth social media

https://yle.fi/a/74-20207494
228•Teever•3h ago•177 comments

Death Note: L, Anonymity and Eluding Entropy (2011)

https://gwern.net/death-note-anonymity
36•teej•1h ago•6 comments

Show HN: Minimal – Open-Source Community driven Hardened Container Images

https://github.com/rtvkiz/minimal
8•ritvikarya98•48m ago•1 comments

Nintendo DS code editor and scriptable game engine

https://crl.io/ds-game-engine/
18•Antibabelic•2h ago•2 comments

Google Cloud suspended my account for 2 years, only automated replies

46•andylizf•2h ago•18 comments

Berlin: Record harvest sparks mass giveaway of free potatoes

https://www.theguardian.com/world/2026/jan/31/record-harvest-berlin-giveaway-potatoes
32•novaRom•1h ago•21 comments

NASA's WB-57 crash lands at Houston

https://arstechnica.com/space/2026/01/one-of-nasas-three-wb-57-aircraft-just-did-a-belly-landing-...
126•verzali•3d ago•67 comments

"Giving up upstream-ing my patches & feel free to pick them up"

https://mail.openjdk.org/pipermail/hotspot-dev/2026-January/118080.html
97•csmantle•9h ago•43 comments

We have ipinfo at home or how to geolocate IPs in your CLI using latency

https://blog.globalping.io/we-have-ipinfo-at-home-or-how-to-geolocate-ips-in-your-cli-using-latency/
171•jimaek•11h ago•46 comments

Guix System First Impressions as a Nix User

https://nemin.hu/guix.html
106•todsacerdoti•9h ago•44 comments

My ridiculously robust photo management system (Immich edition)

https://jaisenmathai.com/articles/my-ridiculously-robust-photo-management-system-immich-edition/
199•jmathai•3d ago•86 comments

Show HN: An extensible pub/sub messaging server for edge applications

https://github.com/narwhal-io/narwhal
12•ortuman•3d ago•0 comments

Show HN: I trained a 9M speech model to fix my Mandarin tones

https://simedw.com/2026/01/31/ear-pronunication-via-ctc/
402•simedw•19h ago•120 comments

Insane Growth Goldbridge (YC F25) Is Hiring a Forward Deployed Engineer

https://www.ycombinator.com/companies/goldbridge/jobs/78gGEHh-forward-deployed-engineer
1•alvinsalehi•8h ago

Antirender: remove the glossy shine on architectural renderings

https://antirender.com/
1762•iambateman•1d ago•420 comments

A novelist who took on the Italian mafia and lived

https://www.thetimes.com/culture/books/article/sicilian-man-leonardo-sciascia-rise-mafia-struggle...
65•Thevet•3d ago•65 comments

Film students who can no longer sit through films

https://www.theatlantic.com/ideas/2026/01/college-students-movies-attention-span/685812/
75•haunter•4h ago•117 comments

HTTP Cats

https://http.cat/
536•surprisetalk•1d ago•83 comments

Peerweb: Decentralized website hosting via WebTorrent

https://peerweb.lol/
343•dtj1123•1d ago•111 comments

Sumerian Star Map Recorded the Impact of an Asteroid (2024)

https://archaeologyworlds.com/5500-year-old-sumerian-star-map-recorded/
128•griffzhowl•13h ago•44 comments

Silver plunges 30% in worst day since 1980, gold tumbles

https://www.cnbc.com/2026/01/30/silver-gold-fall-price-usd-dollar-fed-warsh-chair-trump-metals.html
232•pera•1d ago•246 comments

Show HN: Moltbook – A social network for moltbots (clawdbots) to hang out

https://www.moltbook.com/
83•schlichtm•2d ago•785 comments

Euro firms must ditch Uncle Sam's clouds and go EU-native

https://www.theregister.com/2026/01/30/euro_firms_must_ditch_us/
657•jamesblonde•10h ago•586 comments
Open in hackernews

Detecting if an expression is constant in C

https://nrk.neocities.org/articles/c-constexpr-macro#detecting-if-an-expression-is-constant-in-c
49•signa11•8mo ago

Comments

wahern•8mo ago
> This works. But both gcc and clang warn about the enum being anonymous... even though that's exactly what I wanted to do. And this cannot be silenced with #pragma since it's a macro, so the warning occurs at the location where the macro is invoked.

You can use _Pragma instead of #pragma. E.g.

  #define C(x) ( \
    _Pragma("clang diagnostic push") \
    _Pragma("clang diagnostic ignored \"-Wvisibility\"") \
    (x) + 0*sizeof(void (*)(enum { tmp = (int)(x) })) \
    _Pragma("clang diagnostic pop") \
  )
EDIT: Alas, GCC is a little pickier about where _Pragma is allowed so you may need to use a statement expression. Also, it seems GCC 14 doesn't have a -W switch that will disable the anonymous enum warning.
pjc50•8mo ago
It's remarkable that people will say that doing this kind of thing is better than learning a language which actually lets you enforce this with the type system.

(or even just insist that users use the version of the language which supports "constexpr"!)

oguz-ismail•8mo ago
What language is that? Is it available everywhere (everywhere) C is?
mitthrowaway2•8mo ago
Indeed, usually if I'm using C these days it's because I only have access to a c compiler for my target platform, or because I'm modifying an existing C codebase.
uecker•8mo ago
I do not think anybody said this. The point is that these macros work for early versions of C. If you need to support early versions of C, learning another language is not a solution. If you don't have to, you can use C23's constexpr.
trealira•8mo ago
C used to seem like a beautiful and simple language to me, but as I used it and learned more about it, it seemed more complex under the surface, and kind of janky as well. It's just utilitarian.
wat10000•8mo ago
Learning such a language doesn’t mean I can use it.
o11c•8mo ago
The problem is that no such language exists.

There are many languages that provide one particular feature that C doesn't provide, but they do this at the cost of excluding numerous other features that C widely relies on.

kjs3•8mo ago
"I have no idea what problem you're trying to solve, what the constraints are, what the use cases might be, what tools are available on the platform, what the job or regulations require, what the skillsets of the people involved are, what the timeline is...but I'm absolutely, unshakably certain that I have a magic bullet that will make all your problems go away."

FTFY.

sleirsgoevy•8mo ago
The Linux kernel has even a way to determine whether the expression is compile-time, WITHOUT aborting compilation in either case.

The trick is this (copied vebratim from Linux):

#define __is_constexpr(x) (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))

Explanation: if x is a constant expression, then multiplying it by zero yields a constant 0, and casting a constant 0 to void* makes a null pointer constant. And the ternary expression, if one of its sides is a null pointer constant, collapses to the type of the other side (thus the type of the returned pointer will be int*, and the sizeof will match). And if x was not constant, then the lefthand side would not be considered a null pointer constant by type inference, the type of the ternary expression will be void*, and the sizeof check will not match.

With a few more clever tricks, it's even possible to implement a compile-time "type ternary expression", like this: TYPE_IF(2 * 2 == 4, int, long). This is left as an exercise for the reader.

amelius•8mo ago
This reminds me of the days when Boost was a thing. It was full of tricks like this.
usrnm•8mo ago
It still is a thing, though.
cperciva•8mo ago
With a few more clever tricks...

I did this with my PARSENUM macro (https://github.com/Tarsnap/libcperciva/blob/master/util/pars...) to parse strings into floating-point, unsigned integer, or signed integer types (and check bounds) using a single interface.

bobbyi•8mo ago
I thought this would work:

#define C(x) (sizeof(char[x]), x)

sizeof is a compile-time operation so x need to be known at compile time.

It didn't work as expected. It turns out there is an exception and the standard says that sizeof is actually calculated at runtime specifically for variable length arrays:

> The sizeof operator yields the size (in bytes) of its operand, which may be an expression or the parenthesized name of a type. The size is determined from the type of the operand. The result is an integer. If the type of the operand is a variable length array type, the operand is evaluated; otherwise, the operand is not evaluated and the result is an integer constant.