frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Elixir v1.20: Now a gradually typed language

https://elixir-lang.org/blog/2026/06/03/elixir-v1-20-0-released/
244•cloud8421•1h ago•69 comments

Gemma 4 12B: A unified, encoder-free multimodal model

https://blog.google/innovation-and-ai/technology/developers-tools/introducing-gemma-4-12b/
515•rvz•4h ago•188 comments

I was recently diagnosed with anti-NMDA receptor encephalitis

https://burntsushi.net/encephalitis/
313•Tomte•6h ago•83 comments

DaVinci Resolve 21

https://www.blackmagicdesign.com/products/davinciresolve/whatsnew
306•pentagrama•6h ago•142 comments

Gooey: A GPU-accelerated UI framework for Zig

https://github.com/duanebester/gooey
92•ksec•3h ago•17 comments

ESP32-S31

https://www.espressif.com/en/products/socs/esp32-s31
203•volemo•4h ago•105 comments

Stop Killing Games

https://jxself.org/stop-killing-games.shtml
86•amcclure•2d ago•82 comments

Hacking your PC using your speaker without ever touching it

https://blog.nns.ee/2026/06/03/katana-badusb/
577•xx_ns•9h ago•95 comments

Uber's $1,500/month AI limit is a useful signal for AI tool pricing

https://simonwillison.net/2026/Jun/3/uber-caps-usage/
213•pdyc•8h ago•268 comments

A Post-Quantum Future for Let's Encrypt

https://letsencrypt.org/2026/06/03/pq-certs
169•SGran•5h ago•94 comments

Launch HN: Hyper (YC P26) – Company brain to power agentic development

35•shalinshah•3h ago•30 comments

Angular v22

https://blog.angular.dev/announcing-angular-v22-c52bb83a4664
69•Klaster_1•4h ago•32 comments

Brume is a 24-voice multi-timbral desktop synth for the CM5

https://brume.aftertone.co/
10•oceanwaves•1h ago•2 comments

Skyvern (YC S23) Is Hiring Open-Source Loving DevRel Engineers

https://www.ycombinator.com/companies/skyvern/jobs/1qRTlVx-founding-developer-marketing-open-sour...
1•suchintan•3h ago

Embryos shape their limbs: a key discovery of "genetic brakes"

https://nouvelles.umontreal.ca/en/article/2026/06/02/how-embryos-shape-their-limbs-a-key-discover...
29•gmays•3h ago•0 comments

MacBook Neo Is So Popular That Apple Doubled Production

https://www.macrumors.com/2026/06/03/macbook-neo-production-doubled-says-kuo/
215•tosh•4h ago•213 comments

Rootshell: A new E2EE email service hosted in Iceland

https://rootshell.is
20•sc0rt•1h ago•10 comments

Show HN: Mnemo – local-first AI memory layer for any LLM (Rust, SQLite,petgraph)

https://github.com/zaydmulani09/mnemo
4•zaydmulani•20m ago•0 comments

Meta workers can opt out of being tracked at work up to 30 min

https://www.bbc.com/news/articles/c93x0k194yno
594•reconnecting•8h ago•554 comments

Fluid Simulation for Dummies (2006)

https://www.mikeash.com/pyblog/fluid-simulation-for-dummies.html
47•sebg•4d ago•10 comments

Every Byte Matters

https://fzakaria.com/2026/06/01/every-byte-matters
213•ingve•9h ago•102 comments

Artificial intelligence is not conscious – Ted Chiang

https://www.theatlantic.com/philosophy/2026/06/no-artificial-intelligence-is-not-conscious/687378/
88•lordleft•3h ago•83 comments

PlayStation Architecture

https://www.copetti.org/writings/consoles/playstation/
214•gregsadetsky•10h ago•43 comments

Mathematicians issue warning as AI rapidly gains ground

https://www.science.org/content/article/mathematicians-issue-warning-ai-rapidly-gains-ground
110•pseudolus•10h ago•141 comments

New Texas Instruments 5532 chips are not the 5532s we’ve used for decades

https://groupdiy.com/threads/the-new-ti-5532-chips-are-not-5532s-weve-used-for-decades.93707/
41•SpikedCola•4h ago•18 comments

A Man Who Reads Books for a Living (One Every Two Days)

https://lithub.com/the-man-who-reads-books-for-a-living-one-every-two-days/
6•gmays•44m ago•0 comments

What I've learned about the trombone

http://bryanhu.com/blog/posts/what-ive-learned-about-the-trombone/
69•bookofjoe•10h ago•62 comments

GoPro warned it may not survive

https://thenextweb.com/news/gopro-going-concern-ai-memory-crisis-default
35•mmh0000•1d ago•22 comments

Building iOS Apps with Doom Emacs

https://wassimans.com/blog/building-ios-apps-with-doom-emacs/
15•wassimans•1h ago•1 comments

Show HN: Edsger – A handwritten Clojure REPL for the reMarkable 2

https://handwritten.danieljanus.pl/2026-06-01-edsger.html
223•nathell•1d ago•31 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•1y ago

Comments

wahern•1y 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•1y 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•1y ago
What language is that? Is it available everywhere (everywhere) C is?
mitthrowaway2•1y 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•1y 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•1y 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•1y ago
Learning such a language doesn’t mean I can use it.
o11c•1y 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•1y 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•1y 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•1y ago
This reminds me of the days when Boost was a thing. It was full of tricks like this.
usrnm•1y ago
It still is a thing, though.
cperciva•1y 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•1y 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.