frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Qwen 3.6 27B is the sweet spot for local development

https://quesma.com/blog/qwen-36-is-awesome/
170•stared•1h ago•111 comments

Rocketlab acquires Iridium

https://investors.rocketlabcorp.com/news-releases/news-release-details/rocket-lab-acquire-iridium...
212•everfrustrated•4h ago•125 comments

A native graphical shell for SSH

https://probablymarcus.com/blocks/2026/06/28/native-graphical-shell-for-SSH.html
101•mrcslws•2h ago•50 comments

WATaBoy: JIT-Ing Game Boy Instructions to WASM Beats a Native Interpreter

https://humphri.es/blog/WATaBoy/
102•energeticbark•3h ago•11 comments

US Supreme Court rules geofence warrants require constitutional protections

https://www.theguardian.com/us-news/2026/jun/29/supreme-court-geofence-warrants-case-decision
187•cdrnsf•2h ago•68 comments

What happens when you run a CUDA kernel?

https://fergusfinn.com/blog/what-happens-when-you-run-a-gpu-kernel/
134•mezark•5h ago•10 comments

Wallace the 6 inch f/2.8 telescope, building it, and hiking with it

https://lucassifoni.info/blog/hiking-with-wallace/
20•chantepierre•3d ago•1 comments

Ornith-1.0: self-improving open-source models for agentic coding

https://github.com/deepreinforce-ai/Ornith-1
12•danboarder•1h ago•5 comments

European ISPs Want Rightsholders Held Accountable for Overblocking Damage

https://torrentfreak.com/european-isps-want-rightsholders-held-accountable-for-overblocking-damage/
153•Brajeshwar•2h ago•31 comments

HackerRank open sourced its ATS. My resume scored 90/100. Oh wait 74. No – 88

https://danunparsed.com/p/hackerrank-open-source-ats
883•sambellll•16h ago•379 comments

The Radiation Exposure Lie

https://worksinprogress.co/issue/how-to-lie-about-radiation/
20•duffydotsvg•2h ago•4 comments

Venetian Bridge Brawls in 17th and 18th Century Art

https://publicdomainreview.org/collection/venice-bridge-fights/
32•pepys•3d ago•12 comments

The Return of Aspect Oriented Programming

https://thomaswc.com/blog/the_return_of_aop.html
31•thomaswc•3d ago•24 comments

Sandia National Labs SA3000 8085 CPU

https://www.cpushack.com/2026/06/03/sandia-national-labs-sa3000-8085-cpu/
121•rbanffy•8h ago•34 comments

Tidal AI Policy

https://tidal.com/ai-policy
242•hn8726•5h ago•270 comments

Instagram is incorporating users' photos in ads for Meta Glasses

https://twitter.com/i/status/2071277885646868536
221•notRobot•5h ago•95 comments

You Don't Know Jack About Formal Verification

https://queue.acm.org/detail.cfm?id=3819084
26•eatonphil•4h ago•5 comments

Mag 7 starting to underperform [pdf]

https://www.apollo.com/content/dam/apolloaem/pdf/daily-spark/2026/jun/28/062826-Mag7.pdf
154•mooreds•4h ago•125 comments

CachyOS June 2026 Release

https://cachyos.org/blog/2606-june-release/
93•simonpure•4h ago•49 comments

Halvar's Guide to Entrepreneurship

https://thomasdullien.github.io/guides/entrepreneurship/
144•nekitamo•4d ago•38 comments

Samsung, SK Hynix, Micron Sued in US over Memory Price Fixing

https://en.sedaily.com/international/2026/06/29/samsung-sk-hynix-micron-sued-in-us-over-memory-pr...
217•donohoe•6h ago•100 comments

Pollen tried to remove my article and Google is assisting with it

https://blog.pragmaticengineer.com/pollen-tried-to-remove-my-article-about-callum-negus-fancey-an...
754•taubek•9h ago•105 comments

The CEO of Mullvad is the main financer of the Swedish Örebro party

https://det.social/@lostgen/116820546568940358
283•Risse•7h ago•694 comments

Building Principia for Windows XP

https://voxelmanip.se/2026/06/28/building-principia-for-windows-xp/
88•LorenDB•5h ago•23 comments

Decker Fantasy Camp 2026

https://itch.io/jam/decker-fantasy-camp-2026
25•RodgerTheGreat•2d ago•5 comments

Studio Canal Movies purchased on PlayStation Store removed without refund

https://www.playstation.com/en-gb/legal/psvideocontent/
157•kugelblitz•5h ago•92 comments

NUMA: Cores, memory, and the distance between them

https://edera.dev/stories/numa-part-1-cores-memory-and-the-distance-between-them
107•sys_call•5d ago•21 comments

Rebuilding the Computer Room

https://alexwlchan.net/2026/computer-room/
63•ingve•6h ago•33 comments

Type-checked non-empty strings

https://exploring-better-ways.bellroy.com/haskell-koan-type-checked-non-empty-strings.html
46•surprisetalk•3d ago•28 comments

Dissecting Apple's Sparse Image Format (ASIF)

https://schamper.dev/dissecting-apples-sparse-image-format-asif/
142•supermatou•1d ago•21 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.