frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Saving 100 terabytes of memory by optimizing 1.1.1.1's DNS cache

https://blog.cloudflare.com/dns-cache-memory-optimization-1111/
427•TangerineDream•6h ago•118 comments

Small Models Have Arrived

https://calv.info/small-models-have-arrived
398•tosh•7h ago•178 comments

Doctors are finally learning to manage antidepressant withdrawal

https://www.newscientist.com/article/2584861-antidepressant-withdrawal-symptoms-are-prompting-a-r...
16•eutropheon•55m ago•5 comments

507 Mechanical Movements

https://507movements.com/
431•helloplanets•9h ago•63 comments

Show HN: We built open OpenRouter that turns usage into a better model

https://github.com/experientiallabs/experiential
58•SilenN•2h ago•6 comments

Gemini-3.5-Transcribe

https://blog.google/innovation-and-ai/models-and-research/gemini-models/gemini-3-5-transcribe/
111•k9294•5h ago•27 comments

We found a division by zero bug in FFmpeg with a vibecoded fuzzer

https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/24290
152•dclavijo•5h ago•116 comments

Show HN: OpenTIE and OpenXWA, Modern Ports of Tie Fighter and X-Wing Alliance

https://github.com/elyosh/OpenTIE/
23•elyosh•1h ago•3 comments

Microduck

https://pollen-robotics.com/microduck/
466•robotswantdata•12h ago•176 comments

Decompiling a Nintendo 64 game in 84 days

https://blog.chrislewis.au/decompiling-a-nintendo-64-game-in-84-days/
163•knackers•8h ago•86 comments

M5Stack Launches PaperMono

https://shop.m5stack.com/blogs/news/m5stack-launches-papermono-a-compact-e-ink-development-termin...
82•marksully•5h ago•33 comments

AI Engineer Notebooks – free, framework-free RAG/agents/evals on Colab

https://github.com/calmrocks/ai-engineer-notebooks
12•calmrocks•1h ago•0 comments

The turbulent AI era is here

https://www.gatesnotes.com/work/make-ai-work-for-everyone/reader/a-turbulent-ai-era-and-critical-...
186•nanna•1d ago•443 comments

Previewing the Model Hardware Standard

https://www.anthropic.com/news/model-hardware-standard-research-preview
68•surprisetalk•5h ago•27 comments

Suica, Japan's First IC Transit Card

https://www.tokyodev.com/articles/the-story-of-suica
167•zdw•7h ago•144 comments

Afterglow: Run classic After Dark screen savers on modern macOS

https://morphing.cloud/afterglow/
78•NaOH•23h ago•28 comments

Emacs 31: An unofficial guide to Markdown-ts-mode

https://rahuljuliato.com/posts/markdown-ts-mode-emacs-31
147•RahulMJ•9h ago•61 comments

Meta Paid $17B – Gets to Write Safety Rules for Other SocMedia Platform

https://www.techdirt.com/2026/08/26/meta-just-paid-nearly-17-billion-to-make-sure-it-gets-to-writ...
93•ano-ther•2h ago•7 comments

Bild AI (YC W25) is hiring product and AI engineers

https://www.bild.ai/jobs
1•rooppal•6h ago

Gemini Omni 1.1 Flash

https://blog.google/innovation-and-ai/technology/developers-tools/build-with-gemini-omni-1-1-flash/
172•saretup•6h ago•123 comments

Show HN: The load-bearing vocabulary of Claude

https://louisabraham.github.io/load-bearing/
298•Labo333•14h ago•145 comments

Engineered yeast for converting plastic and biomass compounds into food

https://acs.digitellinc.com/live/37/session/586399
69•ehwa37•7h ago•45 comments

Show HN: Voronoi Go

https://voronoigo.com/
65•igpay•5h ago•11 comments

Nvidia agrees to acquire Hugging Face for $13B

https://www.businessinsider.com/nvidia-in-talks-to-buy-hugging-face-13-billion-dollars-2026-8
1813•mfiguiere•22h ago•850 comments

The mechanics of the Nepali flash flood

https://www.economist.com/science-and-technology/2026/08/27/the-terrifying-mechanics-of-the-nepal...
65•vinni2•8h ago•23 comments

MIT's Ad Hoc Committee on AI Use in Teaching, Learning, and Research Training

https://aiandeducation.mit.edu/report/
98•pbui•10h ago•69 comments

Aphantasia Beginner's Guide

https://aphantasia.com/guide
110•ksec•10h ago•248 comments

Launching Route 53 Files

https://www.daemonology.net/blog/2026-08-27-Launching-Route-53-Files.html
94•louis-paul•8h ago•34 comments

Show HN: Watches user sessions, finds bugs that matter, and fixes them

https://github.com/opslane/opslane
14•aray07•7h ago•4 comments

Autism mutations drive neurodevelopmental pathology

https://www.science.org/doi/10.1126/science.ady4523
76•slantedview•4h ago•102 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.