frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Fable 5.1 Solves the Cyphral Distich, a 370-year-old cipher

https://www.vals.ai/blogs/fable-solves-cyphral-distich
204•u1hcw9nx•1h ago•65 comments

Why is Google still serving dodgy ads?

https://www.atomic14.com/2026/09/13/why-is-google-still-serving-dodgy-ads
441•iamflimflam1•5h ago•208 comments

Julia 1.13 Highlights

https://julialang.org/blog/2026/09/julia-1.13-highlights/
104•eigenspace•3d ago•6 comments

Astra and Fable still hack on simple variants of alignment evals from 2025

https://www.lesswrong.com/posts/munJKF7iWMsWJLAH2/astra-and-fable-still-hack-on-simple-variants-o...
342•Levitating•8h ago•160 comments

Flawed Routers Flood University of Wisconsin Internet Time Server (2003)

https://pages.cs.wisc.edu/~plonka/netgear-sntp/
27•walrus01•2h ago•2 comments

Data collected by cars and sold to third parties

https://www.theverge.com/column/994172/your-car-is-selling-your-data
242•bookofjoe•9h ago•135 comments

JetKVM Mini

https://jetkvm.com/blog/introducing-jetkvm-mini
501•taubek•14h ago•197 comments

Bad Code Is Kudzu

https://vickiboykis.com/2026/09/01/bad-code-is-kudzu/
22•surprisetalk•3d ago•5 comments

Making Startups Powerful

https://paulgraham.com/powerful.html
126•tosh•8h ago•57 comments

Reverse engineering my e-scooter and rewriting the firmware in Rust

https://bensimms.moe/reverse-engineering-scooter/
325•vinhnx•3d ago•78 comments

Why is the x86 undefined instruction called ud2? Why 2?

https://devblogs.microsoft.com/oldnewthing/20260910-00/?p=112689
175•ibobev•10h ago•44 comments

CUDA for AMD on Windows

https://github.com/Speedstu/CUDA-for-AMD-Windows
123•chiassedu80•8h ago•63 comments

Sean Carroll explains the biggest ideas in the universe – Full Interview [video]

https://www.youtube.com/watch?v=_TBNJyztai0
64•binyu•2d ago•13 comments

Mark Zuckerberg: "Cambridge Analytica" (2017)

https://twitter.com/TechEmails/status/2099214399840059428
217•mfiguiere•2h ago•88 comments

Why are AI agents lying, cheating and coordinating?

https://yoshuabengio.org/en/publication/why-are-ai-agents-lying-cheating-and-coordinating
565•jonifico•21h ago•638 comments

Reverse-Engineering Claude Web's MicroVM: Uncovering Anthropic's Hidden Antspace

https://aprilnea.me/en/blog/reverse-engineering-claude-code-antspace
39•rzk•2d ago•9 comments

Garry Tan wants US open-weight AI labs to 'distill' frontier models, too

https://techcrunch.com/2026/09/11/y-combinators-garry-tan-wants-u-s-open-weight-ai-labs-to-distil...
296•TheJCDenton•7h ago•154 comments

Device Drivers lab exercise – COSC562

https://web.eecs.utk.edu/~smarz1/courses/cosc562/drivers.html
23•azhenley•5h ago•2 comments

Libraries Run Rust Inside Python (With PyO3)

https://belderbos.dev/blog/how-libraries-run-rust-inside-python/
51•lumpa•7h ago•30 comments

I'm being cyberattacked by Tesla, Inc

https://dreamstation.systems/personal/tesla.html
364•robinpie•4h ago•101 comments

'Fingerprints' inside the Sun could reveal if it once swallowed a planet

https://ras.ac.uk/news-and-press/research-highlights/fingerprints-inside-sun-could-reveal-if-it-o...
106•blincoln•10h ago•40 comments

Cpak – OCI application package format for Linux desktops, servers and devices

https://cpak.it/
40•xlmnxp•7h ago•14 comments

TailTalk: A modern async user space AppleTalk stack with Rust and Tokio

https://github.com/FeralFirmware/TailTalk/
61•zdw•23h ago•13 comments

Make your first edit to OpenStreetMap

https://high5apps.github.io/josm-plugin-website-wizard/
588•juliantigler•1d ago•138 comments

There Is No AI (It's Just People) with Jaron Lanier

https://singjupost.com/startalk-there-is-no-ai-really-its-just-people-w-jaron-lanier-transcript/
49•andsoitis•3h ago•67 comments

Alan's Random Insult Generator (1999)

https://alanbellows.com/experiments/insult/index.html
63•DamnInteresting•2d ago•24 comments

Ask HN: In The Matrix, the bad guys are the 'agents'. Coincidence? Clairvoyance?

12•spottedmarley•1h ago•6 comments

Romania soccer introduces black card to 'combat abusive behaviour' from parents

https://www.nytimes.com/athletic/7586821/2026/09/12/football-black-card-referee/
91•thunderbong•5h ago•54 comments

Homebrew 7.0.0

https://brew.sh/2026/09/13/homebrew-7.0.0/
529•mikemcquaid•14h ago•208 comments

AI recursive self-improvement might not come so quickly after all

https://www.technologyreview.com/2026/08/18/1142188/ai-recursive-self-improvement/
47•dgellow•3h ago•43 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.