frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Lopado­temacho­selacho­galeo­kranio­leipsano­drim­hypo­trimmato­silphio­karab

https://en.wikipedia.org/wiki/Lopado%C2%ADtemacho%C2%ADselacho%C2%ADgaleo%C2%ADkranio%C2%ADleipsa...
11•firloop•42m ago•1 comments

ASCII characters are not pixels: a deep dive into ASCII rendering

https://alexharri.com/blog/ascii-rendering
904•alexharri•17h ago•112 comments

Kip: A programming language based on grammatical cases of Turkish

https://github.com/kip-dili/kip
143•nhatcher•7h ago•49 comments

Computer Systems Security 6.566 / Spring 2024

https://css.csail.mit.edu/6.858/2024/
48•barishnamazov•4h ago•4 comments

The recurring dream of replacing developers

https://www.caimito.net/en/blog/2025/12/07/the-recurring-dream-of-replacing-developers.html
341•glimshe•14h ago•269 comments

Xous Operating System

https://xous.dev/
101•eustoria•3d ago•29 comments

We put Claude Code in Rollercoaster Tycoon

https://labs.ramp.com/rct
392•iamwil•5d ago•223 comments

If you put Apple icons in reverse it looks like someone getting good at design

https://mastodon.social/@heliographe_studio/115890819509545391
303•lateforwork•4h ago•144 comments

Why Object of Arrays beat interleaved arrays: a JavaScript performance issue

https://www.royalbhati.com/posts/js-array-vs-typedarray
9•howToTestFE•6d ago•0 comments

Raising money fucked me up

https://blog.yakkomajuri.com/blog/raising-money-fucked-me-up
177•yakkomajuri•10h ago•56 comments

No knives, only cook knives

https://kellykozakandjoshdonald.substack.com/p/no-knives-only-cook-knives
3•firloop•4h ago•0 comments

The Olivetti Company

https://www.abortretry.fail/p/the-olivetti-company
148•rbanffy•6d ago•30 comments

Show HN: ChunkHound, a local-first tool for understanding large codebases

https://github.com/chunkhound/chunkhound
59•NadavBenItzhak•7h ago•14 comments

Light Mode InFFFFFFlation

https://willhbr.net/2025/10/20/light-mode-infffffflation/
166•Fudgel•6h ago•127 comments

The relentless rule of my fitness tracker

https://timharford.com/2025/10/the-relentless-rule-of-my-fitness-tracker/
3•Arnt•5m ago•0 comments

How London cracked mobile phone coverage on the Underground

https://www.ianvisits.co.uk/articles/how-london-finally-cracked-mobile-phone-coverage-on-the-unde...
25•beardyw•4d ago•6 comments

Below the Surface: Archeological Finds from the Amsterdam Noord/Zuid Metro Line

https://belowthesurface.amsterdam/en/vondsten
70•stefanvdw1•6d ago•9 comments

IRISC: An ARMv7 assembly interpreter and computer architecture simulator

https://polysoftit.co.uk/irisc-web/
19•rtybanana•4h ago•2 comments

An Elizabethan mansion's secrets for staying warm

https://www.bbc.com/future/article/20260116-an-elizabethan-mansions-secrets-for-staying-warm
124•Tachyooon•11h ago•144 comments

The thing that brought me joy

https://www.stephenlewis.me/blog/the-thing-that-brought-me-joy/
79•monooso•9h ago•36 comments

M8SBC-486 (Homebrew 486 computer)

https://maniek86.xyz/projects/m8sbc_486.php
98•rasz•6d ago•8 comments

Counterfactual evaluation for recommendation systems

https://eugeneyan.com/writing/counterfactual-evaluation/
66•kurinikku•23h ago•5 comments

What twenty years of DevOps has failed to do

https://www.honeycomb.io/blog/you-had-one-job-why-twenty-years-of-devops-has-failed-to-do-it
48•mooreds•9h ago•106 comments

There's no single best way to store information

https://www.quantamagazine.org/why-theres-no-single-best-way-to-store-information-20260116/
80•7777777phil•12h ago•43 comments

The Resonant Computing Manifesto

https://resonantcomputing.org/
48•sinak•11h ago•19 comments

Show HN: Speed Miners – A tiny RTS resource mini-game

https://speedminers.fun/
13•nickponline•6h ago•1 comments

A New Era for FIRST LEGO League: Inspiring the Next Generation of Learners

https://community.firstinspires.org/new-era-first-lego-league-future-edition
14•jchin•5d ago•1 comments

U.S. Court Order Against Anna's Archive Spells More Trouble for the Site

https://torrentfreak.com/u-s-court-order-against-annas-archive-spells-more-trouble-for-the-site/
7•t-3•39m ago•1 comments

Map To Poster – Create Art of your favourite city

https://github.com/originalankur/maptoposter
235•originalankur•18h ago•59 comments

ClickHouse acquires Langfuse

https://langfuse.com/blog/joining-clickhouse
201•tin7in•19h ago•92 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•8mo ago

Comments

wahern•8mo 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•8mo 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•8mo ago
What language is that? Is it available everywhere (everywhere) C is?
mitthrowaway2•8mo 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•8mo 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•8mo 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•8mo ago
Learning such a language doesn’t mean I can use it.
o11c•8mo 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•8mo 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•8mo 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•8mo ago
This reminds me of the days when Boost was a thing. It was full of tricks like this.
usrnm•8mo ago
It still is a thing, though.
cperciva•8mo 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•8mo 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.