frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Local Wikipedia: Wikipedia, but only for things a half hour walk from you

https://edjefferson.com/localwiki/
611•sohkamyung•14h ago•134 comments

OpenSSL 4.1.0

https://github.com/openssl/openssl/releases/tag/openssl-4.1.0
7•petecooper•20m ago•0 comments

Is this the new cyber normal?

https://drew.silcock.dev/blog/is-this-the-new-cyber-normal/
95•drewsberry•1h ago•87 comments

Swedish government offices to ban ChatGPT and Claude

https://www.sverigesradio.se/artikel/chat-gpt-och-claude-forbjuder-regeringskansliet
99•armcat•1h ago•42 comments

Job Loss and Cortisone Mania

https://tilschuenemann.de/job-loss-cortisone-mania
44•speckx•2h ago•5 comments

Docker is weird

https://codeandcake.dev/posts/2026-10-22-docker-is-weird
593•psxuaw•13h ago•255 comments

Remove pgrust: the entry is cheating

https://github.com/ClickHouse/ClickBench/pull/2165
67•f311a•4h ago•33 comments

The foolishness of "natural language programming" (1978)

https://www.cs.utexas.edu/~EWD/transcriptions/EWD06xx/EWD667.html
238•xiaoyu2006•12h ago•147 comments

The alien space of science: Coherent but cognitively unavailable directions

https://arxiv.org/abs/2603.01092
112•martincsweiss•23h ago•45 comments

Dutch government had hacked into Jared Kushner's phone

https://twitter.com/jaredkushner/status/2113376217415958767
135•teekert•2h ago•75 comments

How does Fable 5.1 hide messages in images?

https://www.lesswrong.com/posts/WHEQps5PK8LrrcTAb/how-does-fable-5-1-hide-messages-in-images
134•gmays•15h ago•45 comments

Every AI model has the same "controversial" take on humans

https://www.modelcompare.ai/blog/ai-models-controversial-take-on-humans
496•rakannimer•20h ago•497 comments

OpenShell – A safe, private runtime for fleets of autonomous AI agents

https://github.com/NVIDIA/OpenShell
430•niemandhier•19h ago•198 comments

Show HN: OnKey – I'm a bad singer, so I built an app to show where I'm off-key

https://github.com/dsmurrell/onkey
83•dsmurrell•22h ago•44 comments

The HTML-in-Canvas API origin trial

https://developer.chrome.com/blog/html-in-canvas-origin-trial
71•andrewstuart•17h ago•34 comments

Run full iOS 16.5 firmware on Android Devices

https://github.com/oosexgang/hackios-xnu-kernel
466•aghuang•21h ago•172 comments

This I Believe (1952)

https://www.awakin.org/v2/read/view.php?tid=468
109•ctoth•10h ago•46 comments

Getting ready to operate GNU Taler in Germany

https://www.taler.net/en/news/2026-13.html
329•dewey•20h ago•148 comments

I reverse engineered a board game

https://wuemeli.com/blog/reversing-hitster-game/
61•wuemeli•1d ago•24 comments

Ask HN: If the models are so good, why doesn't OpenAI just start 100 companies?

247•ex-aws-dude•15h ago•261 comments

WorldTUI: I trained a 360M model to pretend to be a terminal

https://simedw.com/2026/10/21/world-model-terminal/
565•alphax314•1d ago•174 comments

Show HN: Making a smart TV dumb and then smart

https://github.com/anubhavmalhotra/r2d2-tv
51•animalhot•12h ago•13 comments

Quad9 to exit France

https://quad9.net/news/blog/au-revoir-france/
1268•farrokhi•22h ago•426 comments

Tell HN: I unknowingly broke the PHP RCE embargo. I am sorry.

615•petecooper•1d ago•228 comments

Jank – The native Clojure dialect with seamless C++ interop

https://jank-lang.org/
125•giancarlostoro•13h ago•18 comments

Xbox wants you to pay 24 to 40 cents per hour to stream games you bought

https://arstechnica.com/gaming/2026/10/xbox-wants-you-to-pay-24-to-40-cents-per-hour-to-stream-ga...
329•entryleveljobsc•1d ago•303 comments

LLMs are making formal software verification feasible at a much larger scale

https://www.anthropic.com/research/formal-verification
376•johnbender•14h ago•228 comments

No Need for Retirement When Utopia Is Around the Corner

https://blog.jim-nielsen.com/2026/skip-retirement-for-utopia/
5•speckx•2h ago•0 comments

Hand-bent after 3D printing, Oberdoerfer and Krebs' Bend chair

https://www.designboom.com/design/hand-bent-3d-printing-oberdoerfer-krebs-digital-fabrication-ben...
15•surprisetalk•2d ago•6 comments

Color Names

https://names.color.pizza
93•akkartik•2d ago•22 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.