frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Temporal: A nine-year journey to fix time in JavaScript

https://bloomberg.github.io/js-blog/post/temporal/
265•robpalmer•3h ago•106 comments

Making WebAssembly a first-class language on the Web

https://hacks.mozilla.org/2026/02/making-webassembly-a-first-class-language-on-the-web/
185•mikece•14h ago•87 comments

Entities enabling scientific fraud at scale are large, resilient, growing (2025)

https://doi.org/10.1073/pnas.2420092122
200•peyton•5h ago•111 comments

BitNet: 100B Param 1-Bit model for local CPUs

https://github.com/microsoft/BitNet
239•redm•6h ago•120 comments

Where Some See Strings, She Sees a Space-Time Made of Fractals

https://www.quantamagazine.org/where-some-see-strings-she-sees-a-space-time-made-of-fractals-2026...
69•tzury•3h ago•9 comments

Show HN: Klaus – OpenClaw on a VM, batteries included

https://klausai.com/
51•robthompson2018•3h ago•39 comments

Show HN: I built a tool that watches webpages and exposes changes as RSS

https://sitespy.app
16•vkuprin•2h ago•7 comments

Lego's 0.002mm specification and its implications for manufacturing (2025)

https://www.thewave.engineer/articles.html/productivity/legos-0002mm-specification-and-its-implic...
295•scrlk•5h ago•234 comments

Launch HN: Prism (YC X25) – Workspace and API to generate and edit videos

https://www.prismvideos.com
21•aliu327•2h ago•11 comments

5,200 holes carved into a Peruvian mountain left by an ancient economy

https://newatlas.com/environment/5-200-holes-peruvian-mountain/
23•defrost•1d ago•5 comments

AI Agent Hacks McKinsey

https://codewall.ai/blog/how-we-hacked-mckinseys-ai-platform
268•mycroft_4221•9h ago•104 comments

Fungal Electronics (2021)

https://arxiv.org/abs/2111.11231
31•byt3h3ad•2h ago•2 comments

The MacBook Neo

https://daringfireball.net/2026/03/the_macbook_neo
115•etothet•7h ago•252 comments

Show HN: Open-source browser for AI agents

https://github.com/theredsix/agent-browser-protocol
53•theredsix•4h ago•17 comments

Searching for the Agentic IDE

https://twitter.com/karpathy/status/2031616709560610993
15•bigwheels•3h ago•16 comments

Wiz joins Google

https://www.wiz.io/blog/google-closes-deal-to-acquire-wiz
102•aldarisbm•4h ago•76 comments

Swiss e-voting pilot can't count 2,048 ballots after decryption failure

https://www.theregister.com/2026/03/11/swiss_evote_usb_snafu/
64•jjgreen•6h ago•139 comments

Show HN: Satellite imagery object detection using text prompts

https://www.useful-ai-tools.com/tools/satellite-analysis-demo/
8•eyasu6464•2d ago•3 comments

Launch HN: Sentrial (YC W26) – Catch AI Agent Failures Before Your Users Do

https://www.sentrial.com/
10•anayrshukla•2h ago•5 comments

Show HN: I built an ISP infrastructure emulator from scratch with a custom vBNG

https://aether.saphal.me/dashboard/default
29•saphalpdyl•5h ago•4 comments

Show HN: Vanilla JavaScript refinery simulator built to explain job to my kids

https://fuelingcuriosity.com/game.html
40•fuelingcurious•2h ago•19 comments

Building a TB-303 from Scratch

https://loopmaster.xyz/tutorials/tb303-from-scratch
184•stagas•3d ago•73 comments

Faster asin() was hiding in plain sight

https://16bpp.net/blog/post/faster-asin-was-hiding-in-plain-sight/
136•def-pri-pub•4h ago•83 comments

Visualizing Ukkonen's Suffix Tree Algorithm

https://www.abahgat.com/blog/visualizing-ukkonens-algorithm/
16•gsky•1d ago•3 comments

Zig – Type Resolution Redesign and Language Changes

https://ziglang.org/devlog/2026/#2026-03-10
368•Retro_Dev•17h ago•203 comments

PeppyOS: A simpler alternative to ROS 2 (now with containers support)

https://peppy.bot/
59•Ekami•3d ago•21 comments

Why the global elite gave up on spelling and grammar

https://www.wsj.com/lifestyle/jeffrey-epstein-files-bad-grammar-spelling-trump-ellison-dorsey-gat...
58•matthieu_bl•3h ago•143 comments

Cloudflare crawl endpoint

https://developers.cloudflare.com/changelog/post/2026-03-10-br-crawl-endpoint/
448•jeffpalmer•20h ago•177 comments

Writing my own text editor, and daily-driving it

https://blog.jsbarretto.com/post/text-editor
196•todsacerdoti•16h ago•103 comments

Yann LeCun raises $1B to build AI that understands the physical world

https://www.wired.com/story/yann-lecun-raises-dollar1-billion-to-build-ai-that-understands-the-ph...
584•helloplanets•1d ago•470 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•10mo ago

Comments

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