frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Dutch governments builds alternative for Microsoft based on NixOS

https://www.dawo.community/en/
366•fjfaase•4h ago•158 comments

Ink and Switch Interactive Homepage

https://www.inkandswitch.com/
58•iFreilicht•2h ago•9 comments

Pentium II at 600Mhz with Voodoo 3 Emulated on 86Box with M6 Mac Mini

https://nyaa.sh/reviews/mac-mini-m6-emulation
97•hugh4life•4h ago•39 comments

F-Droid 2.0

https://f-droid.org/2026/09/24/f-droid-2.0-a-new-chapter-for-android-freedom.html
1289•daveoc64•20h ago•370 comments

CVE-2025-13032: Entering and Breaking the Avast Antivirus Sandbox Part 2

https://www.safateam.com/intelligence-hub/research/technical-articles/cve-2025-13032-entering-and...
63•safateam•5h ago•16 comments

Special Projects (2016)

https://openai.com/index/special-projects/
35•vinhnx•3h ago•11 comments

Show HN: Make cursed fonts like Times New Bastard

https://bastardica.mitpit.com
734•MitPitt•1d ago•101 comments

Show HN: Agentic CUDA Kernel Optimizer

https://github.com/bertaye/agentic-cuda-optimizer
7•bertaye•1h ago•0 comments

Oracle on the hook to pay data centre investors even if site has no electricity

https://www.ft.com/content/a96bf05a-a299-4d6a-a753-b298dd0f4016
48•Betelbuddy•1h ago•32 comments

Show HN: Whiteboard (YC W26) – An open-source IDE for thoughtful software design

https://github.com/devdotfast/whiteboard
332•sidharthkmenon•18h ago•120 comments

Why is the liver so weirdly regenerative?

https://dynomight.substack.com/p/liver
437•jbotz•19h ago•227 comments

The Mafia may be keeping fentanyl out of Italy

https://economist.com/europe/2026/09/24/the-mafia-may-be-keeping-fentanyl-out-of-italy
75•runeks•1h ago•88 comments

What About Rails?

https://jardo.dev/what-about-rails
96•jrochkind1•9h ago•48 comments

2DWillNeverDie

https://2dwillneverdie.com/
262•surprisetalk•2d ago•60 comments

Amiga Screens: A Primer

https://www.datagubbe.se/amscr/
21•msephton•4h ago•3 comments

Topcoat is pushing the boundary of server applications with Rust

https://tokio.rs/blog/2026-09-24-topcoat-server-applications
6•sagacity•2h ago•3 comments

Fearless SIMD v1.0

https://linebender.org/blog/fearless-simd-1-0/
272•verdagon•2d ago•40 comments

Rails World 2026 Opening Keynote [video]

https://www.youtube.com/watch?v=vDjW_dRyKXY
355•an0malous•1d ago•386 comments

Toyota is taking the Corolla electric

https://electrek.co/2026/09/23/toyota-best-selling-corolla-electric/
352•cisc•1d ago•626 comments

My weird new hobby: Wandering around Tokyo on Google Maps

https://ahmedhossamdev.com/writing/my-weird-new-hobby-wandering-around-tokyo/
349•ahmedhossamdev•2d ago•162 comments

Opus 5.5 is good at explainer videos

https://launchvideo.io
294•iacguy•15h ago•154 comments

Using LLMs to trace alchemical knowledge and decode 17th century letters

https://resobscura.substack.com/p/ai-labs-need-to-start-funding-historical
139•benbreen•16h ago•31 comments

Two-tier encryption in the UK

https://macanorak.com/two-tier-encryption-in-the-uk/
468•ReturnoftheHack•1d ago•416 comments

Google’s Project Suncatcher to put ML infrastructure in space

https://blog.google/innovation-and-ai/models-and-research/google-research/google-project-suncatch...
197•xnx•22h ago•400 comments

Writing Parquet files using Haskell

https://www.datahaskell.org/blog/2026/09/18/writing-parquet-files-using-haskell.html
72•cosmic_quanta•2d ago•18 comments

Boards of Casio

https://www.ambionix.com/blog/boards-of-casio/
4•fidotron•2h ago•0 comments

Book review: Is parallel programming hard, and, if so, what can you do about it?

https://ahelwer.ca/post/2026-09-21-concurrency-textbook/
129•ahelwer•3d ago•57 comments

Sourcehut account takeover via build logs (XSS in ansi2html)

https://blog.arusekk.pl/posts/srht-account-takeover/
133•arusekk•16h ago•25 comments

Nokia Design Archive (2025)

https://repo.aalto.fi/index.php?name=SO_b66a9391-dcf8-4399-8e87-611f84c3fc4c
239•pillars•1d ago•129 comments

The Board Game of the Alpha Nerds (2014)

https://grantland.com/features/diplomacy-the-board-game-of-the-alpha-nerds/
94•neonate•15h ago•51 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.