frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Honda Civics and the Evil Valet

https://juniperspring.org/posts/honda-evil-valet/
233•librick•6h ago•39 comments

Don't trust large context windows

https://garrit.xyz/posts/2026-05-06-dont-trust-large-context-windows
21•computersuck•1h ago•12 comments

Phoenix LiveView 1.2 Released

https://phoenixframework.org/blog/phoenix-liveview-1-2-released
54•ksec•2h ago•4 comments

Consciousness likely not unique to earthlings, paper says

https://news.ucr.edu/articles/2026/06/10/consciousness-likely-not-unique-earthlings-paper-says
20•giuliomagnifico•2h ago•14 comments

GLM 5.2 Is Out

https://twitter.com/jietang/status/2065784751345287314
524•aloknnikhil•15h ago•280 comments

Free SQL→ER diagram tool, runs in the browser, nothing uploaded

https://sqltoerdiagram.com/
66•robhati•4h ago•15 comments

Noise infusion banned from statistical products published by Census Bureau

https://desfontain.es/blog/banning-noise.html
805•nl•17h ago•506 comments

Tribblix: The retro Illumos distribution

http://tribblix.org/
26•naturalmovement•2h ago•6 comments

Every Frame Perfect

https://tonsky.me/blog/every-frame-perfect/
671•ravenical•20h ago•222 comments

Building a serial and VGA "everything console"

http://oldvcr.blogspot.com/2026/06/building-serial-and-vga-everything.html
25•classichasclass•5h ago•1 comments

FreeOberon – Open-Source, Cross-Platform, Free Pascal/Turbo Pascal-Like Language

https://github.com/kekcleader/FreeOberon
74•peter_d_sherman•2d ago•27 comments

Treating pancreatic tumours may have revealed cancer's master switch

https://economist.com/science-and-technology/2026/06/12/treating-pancreatic-tumours-may-have-reve...
349•andsoitis•18h ago•126 comments

Python 3.14 garbage collection rigamarole

https://theconsensus.dev/p/2026/06/06/python-3-14-garbage-collection-rigamarole.html
42•eatonphil•1d ago•26 comments

Pyodide 314.0: Python packages can now publish WebAssembly wheels to PyPI

https://blog.pyodide.org/posts/314-release/
118•agriyakhetarpal•4d ago•27 comments

Weave: Merging based on language structure and not lines

https://ataraxy-labs.github.io/weave/
26•rohanat•5h ago•12 comments

Making Claude a Chemist

https://www.anthropic.com/research/making-claude-a-chemist
30•gmays•4h ago•18 comments

(Re//Verse 2026) Taxonomy and Deobfuscation of a Real World Binary Obfuscator [pdf]

https://github.com/AnalogCyberNuke/RE-Verse-2026-Slides/blob/main/Reverse26.pdf
13•not_a9•2d ago•1 comments

Beagle: Git, URIs and all the dirty words

https://replicated.wiki/blog/uris.html
3•gritzko•2d ago•0 comments

Codex for open source

https://openai.com/form/codex-for-oss/
221•EvgeniyZh•2d ago•81 comments

LaserWriter Seeds

https://inventingthefuture.ghost.io/laserwriter-seeds/
10•frizlab•3d ago•0 comments

Pac-Man, but you're the ghost

https://garrit.xyz/posts/2026-06-13-pac-man-but-you-re-the-ghost
68•mindracer•3h ago•32 comments

GameBoy Workboy

https://tcrf.net/Workboy
181•tosh•14h ago•64 comments

Amazon CEO's talks with U.S. officials triggered crackdown on Anthropic models

https://www.wsj.com/tech/ai/amazon-ceos-talks-with-u-s-officials-triggered-crackdown-on-anthropic...
653•ls612•14h ago•486 comments

Software Architecture Guide (2019)

https://martinfowler.com/architecture/
50•laxmena•3h ago•19 comments

Running DOS on Behringers DDX3216 with a DIY x86-Bios from Scratch

https://chrisdevblog.com/2026/06/08/running-dos-on-behringers-ddx3216-using-a-diy-x86-bios/
91•rasz•13h ago•20 comments

A low-carbon computing platform from your retired phones

https://research.google/blog/a-low-carbon-computing-platform-from-your-retired-phones/
279•vikas-sharma•22h ago•151 comments

ReactOS (FOSS "Windows") achieves 3D-accelerated Half-Life on real hardware

https://www.phoronix.com/news/ReactOS-Running-Half-Life
187•jeditobe•8h ago•27 comments

The Neat Little Vehicles That Run a Cemetery

https://www.thedrive.com/news/meet-the-neat-little-vehicles-that-run-a-cemetery
7•PaulHoule•4d ago•0 comments

Appreciating Exif

https://brentfitzgerald.com/posts/appreciating-exif/
152•burnto•4d ago•33 comments

RTX 5080 and RTX 3090 Setup: 80 Tok/s on Qwen 3.6 27B Q8

https://imil.net/blog/posts/2026/rtx-5080-+-rtx-3090-setup-80+-tok-s-on-qwen-3.6-27b-q8/
236•iMil•21h ago•79 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.