frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Scientific study reveals TikTok videos deactivate key cognitive brain regions

https://www.rathbiotaclan.com/tiktok-videos-deactivate-key-cognitive-brain-regions/
68•Akasci•43m ago•14 comments

I like 'em thick: an apology to my English teachers

https://www.experimental-history.com/p/i-like-em-thick
376•Ariarule•2d ago•170 comments

I should have loved biology

https://jsomers.net/i-should-have-loved-biology/
82•tyre•1h ago•31 comments

AliExpress runs silent WebAudio fingerprinting that breaks Bluetooth multipoint

https://blog.laserphile.com/2026/08/aliexpress-webpage-keeping-multipoint.html
733•emctech•9h ago•245 comments

HTML Can Do That

https://chrisburnell.com/html-can-do-that/
385•encyclopedism•1d ago•109 comments

Linux 7.2

https://www.igalia.com/2026/08/19/Linux-72-Released.html
106•mariuz•3h ago•41 comments

CIA funding helped keep NeXT afloat in the 80s

https://www.wsj.com/tech/steve-jobs-apple-next-cia-161b65f9?st=NWWds1&reflink=desktopwebshare_per...
239•EwanG•19h ago•141 comments

Show HN: I trained a 125M model to autocomplete piano on-device

https://simedw.com/2026/08/20/midi-autocomplete/
398•simedw•7h ago•95 comments

The August 17 outage, and the work ahead

https://github.blog/news-insights/company-news/the-august-17-outage-and-the-work-ahead/
6•0xedb•15m ago•0 comments

How to compromise your system with a job interview

https://www.codedge.de/posts/how-to-compromise-your-system-with-a-job-interview
79•codedge•3h ago•41 comments

Sixtyfour (YC P25) Is Hiring

https://www.ycombinator.com/companies/sixtyfour/jobs/39SkSrA-software-engineering-intern
1•HPMOR•2h ago

Consumer Rights Wiki

https://consumerrights.wiki/w/Main_Page
14•gregsadetsky•1h ago•0 comments

Show HN: We chased a weather balloon across Montana and never found it

https://radi8.dev/blog/uplink/
32•radeeyate•2h ago•12 comments

Optimizing things in the USSR (2016)

https://chris-said.io/2016/05/11/optimizing-things-in-the-ussr/
20•cassepipe•1h ago•13 comments

Show HN: Huzzah – a novel approach to coding with AI

https://www.danielvaughn.dev/posts/huzzah/
6•danielvaughn•32m ago•4 comments

Project Cybersyn (2022)

https://bactra.org/notebooks/cybersyn.html
24•cassepipe•1h ago•12 comments

Malicious Rust crate Arrayref runs a build-time payload

https://safedep.io/arrayref-proc-macro1-rust-build-time-malware/
300•abhisek•6h ago•260 comments

DiffusionGemma Technical Report

https://arxiv.org/abs/2608.00146
113•gmays•6h ago•27 comments

Xorg-server 26.1.0 rc1

https://lists.x.org/archives/xorg-announce/2026-August/003741.html
94•st_goliath•6h ago•69 comments

Generic Methods in Go 1.27

https://dominik.info/blog/go-generic-methods
50•EspressoGPT•3h ago•17 comments

Show HN: Omacosy – Omarchy-style tiling desktop for macOS, no SIP

https://github.com/paulsp94/omacosy
23•paulsp•5h ago•18 comments

Mojo is now open source

https://www.modular.com/blog/mojo-open-source
277•visheshdembla•2d ago•63 comments

Git at any scale

https://cursor.com/blog/git-at-any-scale
199•meetpateltech•2d ago•44 comments

Gauguin, Descartes, Bayes: A Diurnal Golem's Brain

https://dl.acm.org/doi/10.1145/3759429.3762631
8•asdftemp•1w ago•2 comments

Show HN: Open-source Stripe Connect alternative

https://zoneless.com
48•tinyprojects•4h ago•20 comments

Every Model Cheats

https://dreadnode.io/research/every-model-cheats-prompt-level-mitigation-of-cheating-on-offensive...
57•vga805•5h ago•38 comments

Windows brings out the Rorschach test in everyone (2003)

https://devblogs.microsoft.com/oldnewthing/20030825-00/?p=42803
328•luu•13h ago•122 comments

Launch HN: Vendo (YC S26) – Let users build features on top of your product

https://github.com/runvendo/vendo
27•yousefh409•4h ago•16 comments

URL shortener links stored in your ATProto PDS

https://atpr.to/
16•jcbhmr•2h ago•2 comments

Stop Anthropomorphizing Intermediate Tokens as Reasoning/Thinking Traces

https://arxiv.org/abs/2504.09762
161•nunodonato•1d ago•69 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.