frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Isaac Asimov: The Last Question

https://hex.ooo/library/last_question.html
272•ColinWright•2h ago•92 comments

We Reproduced Anthropic's Mythos Findings with Public Models

https://blog.vidocsecurity.com/blog/we-reproduced-anthropics-mythos-findings-with-public-models
38•__natty__•41m ago•6 comments

Healthchecks.io Now Uses Self-Hosted Object Storage

https://blog.healthchecks.io/2026/04/healthchecks-io-now-uses-self-hosted-object-storage/
11•zdw•22m ago•3 comments

It Is Time to Ban the Sale of Precise Geolocation

https://www.lawfaremedia.org/article/it-is-time-to-ban-the-sale-of-precise-geolocation
41•hn_acker•25m ago•3 comments

Claude Opus 4.7

https://www.anthropic.com/news/claude-opus-4-7
1874•meetpateltech•1d ago•1358 comments

Ada, Its Design, and the Language That Built the Languages

https://www.iqiipi.com/the-quiet-colossus.html
171•mpweiher•5h ago•101 comments

Codex for almost everything

https://openai.com/index/codex-for-almost-everything/
940•mikeevans•21h ago•499 comments

FIM – Linux framebuffer image viewer

https://www.nongnu.org/fbi-improved/
102•Mr_Minderbinder•7h ago•54 comments

CadQuery is an open-source Python library for building 3D CAD models

https://cadquery.github.io/
185•gregsadetsky•2d ago•48 comments

中文 Literacy Speedrun II: Character Cyclotron

https://blog.kevinzwu.com/character-cyclotron/
56•surprisetalk•4d ago•25 comments

A Python Interpreter Written in Python

https://aosabook.org/en/500L/a-python-interpreter-written-in-python.html
106•xk3•3d ago•29 comments

Show HN: Stage – Putting humans back in control of code review

https://stagereview.app/
28•cpan22•21h ago•21 comments

How Big Tech wrote secrecy into EU law to hide data centres' environmental toll

https://www.investigate-europe.eu/posts/big-tech-data-centres-secrecy-eu-law-environment-footprint
144•cyberlimerence•6h ago•55 comments

Official Clojure Documentary page with Video, Shownotes, and Links

https://clojure.org/about/documentary
280•adityaathalye•19h ago•77 comments

30 Years of HPC: many hardware advances, little adoption of new languages

https://chapel-lang.org/blog/posts/30years/
87•matt_d•3d ago•65 comments

Android CLI: Build Android apps 3x faster using any agent

https://android-developers.googleblog.com/2026/04/build-android-apps-3x-faster-using-any-agent.html
274•ingve•20h ago•115 comments

Human Accelerated Region 1

https://en.wikipedia.org/wiki/Human_accelerated_region_1
83•apollinaire•10h ago•47 comments

The missing catalogue: why finding books in translation is still so hard

https://blogs.lse.ac.uk/impactofsocialsciences/2026/04/13/the-missing-catalogue-why-finding-books...
10•AusiasTsel•3d ago•2 comments

Show HN: SPICE simulation → oscilloscope → verification with Claude Code

https://lucasgerads.com/blog/lecroy-mcp-spice-demo/
102•_fizz_buzz_•14h ago•21 comments

Playdate’s handheld changed how Duke University teaches game design

https://news.play.date/news/duke-playdate-education/
212•Ivoah•19h ago•99 comments

Teddy Roosevelt and Abraham Lincoln in the same photo

https://prologue.blogs.archives.gov/2010/11/09/teddy-roosevelt-and-abraham-lincoln-in-the-same-ph...
13•bryanrasmussen•5h ago•0 comments

Guy builds AI driven hardware hacker arm from duct tape, old cam and CNC machine

https://github.com/gainsec/autoprober
206•scaredpelican•16h ago•41 comments

ReBot-DevArm: open-source Robotic Arm

https://github.com/Seeed-Projects/reBot-DevArm
83•rickcarlino•4d ago•20 comments

Substrate AI Is Hiring Harness Engineers

https://www.ycombinator.com/companies/substrate/jobs/QJU9023-harness-engineer
1•kunle•11h ago

A Better R Programming Experience Thanks to Tree-sitter

https://ropensci.org/blog/2026/04/02/tree-sitter-overview/
142•sebg•17h ago•27 comments

Qwen3.6-35B-A3B: Agentic coding power, now open to all

https://qwen.ai/blog?id=qwen3.6-35b-a3b
1191•cmitsakis•1d ago•494 comments

A Git helper tool that breaks large merges into parallelizable tasks

https://github.com/mwallner/mergetopus
53•schusterfredl•4d ago•14 comments

Is Your Site Agent-Ready? (By Cloudflare)

https://isitagentready.com
25•WesSouza•55m ago•43 comments

Cloudflare's AI Platform: an inference layer designed for agents

https://blog.cloudflare.com/ai-platform/
300•nikitoci•1d ago•78 comments

The beginning of scarcity in AI

https://tomtunguz.com/ai-compute-crisis-2026/
137•gmays•18h ago•170 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•11mo ago

Comments

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