frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Flipper One – we need your help

https://blog.flipper.net/flipper-one-we-need-your-help/
149•sandebert•1h ago•68 comments

Python 3.15: features that didn't make the headlines

https://blog.changs.co.uk/python-315-features-that-didnt-make-the-headlines.html
54•rbanffy•1h ago•20 comments

Show HN: Rmux – A programmable terminal multiplexer with a Playwright-style SDK

https://github.com/helvesec/rmux
86•shideneyu•3h ago•47 comments

An OpenAI model has disproved a central conjecture in discrete geometry

https://openai.com/index/model-disproves-discrete-geometry-conjecture/
1233•tedsanders•17h ago•899 comments

GitHub confirms breach of 3,800 repos via malicious VSCode extension

https://www.bleepingcomputer.com/news/security/github-confirms-breach-of-3-800-repos-via-maliciou...
906•Timofeibu•22h ago•379 comments

Google officially announces that ads will be included in AI Mode search results

https://blog.google/products/ads-commerce/google-marketing-live-search-ads/
178•sofumel•2h ago•189 comments

Cekura (YC F24) Is Hiring

https://www.ycombinator.com/companies/cekura-ai/jobs/AiWwUxI-forward-deployed-engineer-us
1•atarus•30m ago

Fender escalates legal campaign against S-style guitars

https://www.guitarworld.com/gear/electric-guitars/fender-cease-and-desist-lsl-instruments
27•rectang•2d ago•18 comments

Lost Images from the 1945 Trinity Nuclear Test Restored

https://spectrum.ieee.org/trinity-nuclear-test
14•pseudolus•1h ago•3 comments

Show HN: I reverse engineered Apple's video wallpapers

https://github.com/kageroumado/phosphene
327•kageroumado•12h ago•77 comments

Haskell Foundation 2026 Update

https://discourse.haskell.org/t/haskell-foundation-2026-update/14136
134•azhenley•10h ago•47 comments

Earth is now heating up twice as fast as in previous decades

https://www.newscientist.com/article/2518362-earth-is-now-heating-up-twice-as-fast-as-in-previous...
52•Anon84•1h ago•27 comments

The Letter S, by Donald Knuth (1980) [pdf]

https://gwern.net/doc/design/typography/1980-knuth.pdf
202•bambax•12h ago•28 comments

Flipper One Tech Specs

https://docs.flipper.net/one/general/tech-specs
423•gregsadetsky•17h ago•142 comments

No Slop Grenade

https://noslopgrenade.com/
81•napolux•2h ago•45 comments

New features in GCC 16: Improved error messages and SARIF output

https://developers.redhat.com/articles/2026/04/28/gcc-16-improved-error-messages-sarif-output
105•siteshwar•2d ago•17 comments

DOS Zone

https://dos.zone/
278•rglover•13h ago•65 comments

All the bugs they found

https://andreapivetta.com/posts/all-the-bugs-they-found.html
47•ziggy42•2d ago•14 comments

Anthropic is expanding to Colossus2. Will use GB200

https://twitter.com/nottombrown/status/2057194829986300375
226•aurareturn•15h ago•246 comments

Simulating Infinity in Conway's Game of Life with Modern C++

https://ryanjk5.github.io/posts/GOLDE/
51•HeliumHydride•2d ago•11 comments

How fast is N tokens per second really?

https://mikeveerman.github.io/tokenspeed/
435•hexagr•3d ago•89 comments

Show HN: I made a tactical map-based WWII submarine simulator (public beta)

https://silentshark.app/alpha/
72•epaga•2d ago•25 comments

OpenAI Is Preparing to File for an IPO Soon

https://www.wsj.com/tech/ai/openai-is-preparing-to-file-for-an-ipo-very-soon-0ec95af5
127•louiereederson•20h ago•268 comments

Archaeologists find Egyptian mummy buried with the 'Iliad'

https://www.openculture.com/2026/05/archaeologists-discover-ancient-egyptian-mummy-buried-with-pa...
157•diodorus•5d ago•118 comments

Vivaldi 8.0

https://vivaldi.com/blog/vivaldi-on-desktop-8-0/
177•OuterVale•5h ago•101 comments

Saying goodbye to asm.js

https://spidermonkey.dev/blog/2026/05/20/saying-goodbye-to-asmjs.html
392•eqrion•1d ago•150 comments

Reviving old scanners with an in-browser Linux VM bridged to WebUSB over USB/IP

https://yes-we-scan.app/details
93•gmac•3d ago•29 comments

Recreate famous water profiles using supermarket bottled water

https://www.waterdictionary.net
60•smugglerFlynn•2d ago•32 comments

What is a Demand Coop

https://cahootzcoops.com/blog/what-is-a-demand-coop
71•DeonRob•11h ago•75 comments

Show HN: The Hanging Sculptures of the Xiaoxitian

https://funes.world/apps/the-hanging-sculptures-of-the-xiaoxitian
14•hanyangwang•2d ago•4 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.