frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Claude: Degraded Performance for Multiple Models

https://status.claude.com/incidents/q7txxvbsftgq
54•matt89•24m ago•31 comments

Apple announces changes for apps in the European Union

https://www.apple.com/newsroom/2026/08/apple-announces-changes-for-apps-in-the-european-union/
49•newusertoday•31m ago•33 comments

Using the railway network as a flatbed scanner

https://philo.gay/linecam/
246•otherayden•4h ago•42 comments

The Amazon Tax

https://seths.blog/2026/08/the-amazon-tax/
408•herbertl•3h ago•288 comments

How I Under-Engineered My Book

https://chriskiehl.com/article/how-i-under-engineered-my-book
44•goostavos•21h ago•11 comments

Fixing a Bricked Framework Laptop

https://quantum5.ca/2026/08/16/fixing-bricked-amd-7040-series-framework-13-laptop-with-20-tools/
179•jp_sc•3h ago•100 comments

Linux 7.3 improves performance when running out of vRAM

https://pixelcluster.dev/VRAM-Overcommit/
404•flaburgan•9h ago•160 comments

Python Polars Cheatsheet (based on our O'Reilly book)

https://opensource.posit.co/resources/cheatsheets/polars/
73•jeroenjanssens•3h ago•12 comments

Launch HN: machine0 (YC S26) – Persistent CPU and GPU VMs from the CLI

https://machine0.io
6•bwm•26m ago•2 comments

Cursor launches Origin, GitHub alternative

https://cursor.com/changelog/origin-code-hosting
143•tomasreimers•23h ago•89 comments

Teaching my kid to code with a modern MUD

https://tau.dev/2026/08/07/canon
143•andrewjanke•6d ago•46 comments

Composable Tests

https://newsletter.kentbeck.com/p/composable-tests
42•vinipolicena•3h ago•34 comments

Fairphone is now officially available in the United States

https://www.fairphone.com/nl/stories/the-fairphone-gen-6-is-all-about-giving-you-more
226•Vinnl•4h ago•115 comments

Babies born under sugar rationing grew into adults with lower cancer risk

https://theconversation.com/babies-born-under-sugar-rationing-grew-into-adults-with-lower-cancer-...
106•zeristor•2h ago•26 comments

Splitting a Git Commit

https://blog.gnoack.org/post/git-history-split
35•signa11•3d ago•17 comments

Superpowers, Not Superintelligence

https://bond.now/news/superpowers-not-superintelligence
3•edbernays•25m ago•0 comments

Code-native generation of highly programmable 3D assets (2026)

https://arxiv.org/abs/2607.22738
18•baigy•1h ago•19 comments

Google has acquired the data of failed US airline Spirit

https://www.theregister.com/ai-and-ml/2026/08/18/google-buys-crashed-airline-spirits-data-at-auct...
446•pseudolus•6h ago•318 comments

Memory prices climb 500% in 12 months

https://www.tomshardware.com/pc-components/ram/memory-prices-climb-500-percent-in-12-months-up-to...
128•haunter•23h ago•95 comments

Meta Files Patent for Facial Recognition, Automatic Recording of People

https://www.privacyguides.org/news/2026/08/17/meta-files-patent-for-facial-recognition-automatic-...
171•DeepLogin•4h ago•117 comments

How Bluesky draws its logo on screenshots

https://timmarinin.net/2026/bluesky-screenshots/
660•gavide•18h ago•416 comments

Show HN: Shoehorn – Quantize any model down to run on your machine

https://notactuallytreyanastasio.github.io/shoehorn/
17•rhgraysonii•2h ago•2 comments

Show HN: Openleetcode – local LeetCode runner where tests live in the repo

https://github.com/therepanic/openleetcode
5•therepanic•1h ago•1 comments

California's new tire efficiency rules could save drivers $1B a year

https://grist.org/transportation/californias-new-tire-efficiency-rules-could-save-drivers-1b-a-year/
51•littlexsparkee•13h ago•57 comments

Rethinking Database Programming

https://acadia.engineering/blog/rethinking-database-programming
178•honungsburk•9h ago•91 comments

The coolest anti-surveillance tools at Defcon [video]

https://www.youtube.com/watch?v=-2uAsJ5EPAw
46•neom•2h ago•2 comments

Ask HN: Ive quit six systems for tracking my illness. What works?

9•Abh1Works•2d ago•6 comments

Baking a Model: A Metaphor for LLM Training

https://newsletter.kentbeck.com/p/baking-a-model
26•KentBeck•3d ago•1 comments

Finger: Social network that never died

https://en.andros.dev/blog/54572bc7/finger-the-1971-social-network-that-never-died/
126•andros•9h ago•40 comments

Quake Shareware, a CD-ROM just a little too full

https://fabiensanglard.net/quake_shareware_cd/index.html
456•shdon•18h ago•193 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.