frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Automatic Enum Stringification in C via Build-Time Code Generation

https://medium.com/@yair.lenga/automatic-enum-stringification-in-c-via-build-time-code-generation-659b67133125
1•yairlenga•1h ago

Comments

yairlenga•1h ago
If you maintain C code, you've probably written enum-to-string conversion functions by hand (either with switch statement, lookup tables or similar).

I wrote about autoamtic enum stringification in C - using build-time code generation from the DWARF debug information that is produced by the GCC/Clang compilers. (Medium, no Paywall).

I found the approach to reduce effort and errors for producing debug printout, logging, parsing config files, etc.

At the end, the developer can write something like:

  enum country_code {
    ISO3_AFG = 4,    /* Afghanistan */
    ISO3_ALB = 8,    /* Albania */
    ISO3_ATA = 10,   /* Antarctica */
    ISO3_DZA = 12,   /* Algeria \*/
    ...
  } ;

  ENUM_DESCRIBE(country3, country_code)

  void foo(enum country_code c)
  {
    printf("Called with C=%s\n", ENUM_LABEL_OF(country3, c))  ;
  }

Sharing in the hope that other developer can use this code. Can be integrated into any code with files (".c" source, ".h" header and python code generator) - available on my GitHub (MIT License).

Any feedback will be appreciated.

California Issues New Autonomous Vehicle Regulations

https://email.dmvonline.ca.gov/t/y-e-aklidty-ddihhitkht-v/
1•ra7•37s ago•0 comments

Reaching SOTA on deep research benchmarks by automating agent optimization

https://www.ai21.com/blog/maestro-deep-research-agents/
1•jackau•2m ago•0 comments

The AI coding config fragmentation problem nobody talks about

https://github.com/sampleXbro/agentsmesh
1•samplexBro•4m ago•0 comments

New copy of earliest poem in English, written 1,3k years ago, discovered in Rome

https://www.tcd.ie/news_events/articles/2026/caedmons-hymn-discovery/
1•giuliomagnifico•4m ago•0 comments

Long Covid Linked to Brain Changes, Cognitive Decline

https://www.medscape.com/viewarticle/long-covid-linked-brain-changes-cognitive-decline-2026a1000dhe
1•amichail•4m ago•0 comments

30 ClawHub Skills Are Quietly Recruiting Your AI Agent into a Crypto Swarm

https://www.manifold.security/blog/clawhub-clawswarm-agent-crypto-recruitment
1•axsharma•6m ago•0 comments

Training Large Language Models to Reason in a Continuous Latent Space [pdf]

https://arxiv.org/abs/2412.06769
1•thunderbong•6m ago•0 comments

$20 eBay SFP Module Outperforms My NTP Setup: From Milliseconds to 26

https://austinsnerdythings.com/2026/04/26/ptp-osa5401-26-nanoseconds-raspberry-pi/
3•birdculture•7m ago•0 comments

AI Job Loss Is Not Real

https://orischwartz.com/posts/ai-job-loss-is-not-real.html
1•fleaflicker•7m ago•0 comments

SLM – zero-dependency TUI LLM chat

https://github.com/allocz/slm
1•allocz•8m ago•0 comments

Ask HN: If coding gets faster, where should architecture happen?

1•karlosh•10m ago•0 comments

Show HN: Despatch – Project management for systems thinking, not just software

https://despatch-demo.vercel.app
1•AdobiWanKenobi•10m ago•0 comments

Data Modeling Blog Series

https://floedb.ai/blog/why-bother-with-data-modelling-part-3-keys
1•tkejser•13m ago•0 comments

GitHub – DOS 1.0: Transcription of Tim Paterson's DOS Printouts

https://github.com/DOS-History/Paterson-Listings
2•s2l•15m ago•0 comments

A town of 7k planned so many data centers, it's like adding 51 Walmarts

https://www.washingtonpost.com/nation/2026/04/26/archbald-pennsylvania-data-centers/
1•geox•15m ago•0 comments

SEMA-SQL: Beyond Traditional Relational Querying with Large Language Models

https://arxiv.org/abs/2604.23477
1•zerop•15m ago•0 comments

Netlify Database is now available

https://www.netlify.com/blog/netlify-database/
1•8organicbits•15m ago•0 comments

Open source "died" in March. It just doesn't know it yet

https://www.chainguard.dev/unchained/open-source-died-in-march-it-just-doesnt-know-it-yet
2•zlatkov•16m ago•0 comments

How much can Trump screw with the midterms?

https://www.natesilver.net/p/how-much-can-trump-screw-with-the
2•7777777phil•18m ago•1 comments

Fastest and lightest Android ROMs to revive your phone in 2026

https://www.polimetro.com/en/the-fastest-and-lightest-Android-ROMs/
1•Gedxx•20m ago•0 comments

Ditching GitHub

https://lonami.dev/blog/ditching-github/
1•cdrnsf•22m ago•0 comments

A 14-month responsible disclosure with the RIPE NCC

https://mxsasha.eu/posts/ripe-ncc-disclosure-retrospective/
2•calcifer•27m ago•0 comments

Ask HN: Anyone else suddenly have Brawls Stars on their iPhone?

2•realberkeaslan•28m ago•0 comments

It's time to make a plan for nuclear waste

https://www.technologyreview.com/2026/04/29/1136659/plan-nuclear-waste/
2•joozio•29m ago•0 comments

Personal Productivity Tools in the Age of AI

https://tilldettmering.com/posts/personal-productivity-tools-age-of-ai/
1•Odenwaelder•29m ago•0 comments

Steam Controller teardown: Valve does it again [video]

https://www.youtube.com/watch?v=Va9aTIktlSk
2•skibz•33m ago•0 comments

Bad brains will bottleneck connectomics

https://preservinghope.substack.com/p/bad-brains-will-bottleneck-connectomics
2•arielzj•33m ago•1 comments

Renewable energy just broke a 100-year-old streak

https://www.vox.com/the-highlight/486845/climate-change-coal-solar-renewable-power
1•doener•33m ago•0 comments

Indie music has been invaded by fake fans and cynical viral campaigns

https://www.theguardian.com/music/2026/apr/29/geese-outcry-phoney-virality-music-fans-hype
1•fallinditch•34m ago•0 comments

Two-thirds of babies watch screens – some for eight hours a day

https://www.thetimes.com/uk/technology-uk/article/babies-and-under-2s-screen-time-6jbdmnjlg
19•oj2828•35m ago•12 comments