Project ideas from Hacker News discussions.

Some C habits I employ for the modern day

šŸ“ Discussion Summary (Click to expand)

Prevalent Themes in the Hacker News Discussion

The discussion is dominated by debates on C programming practices, language evolution, and the trade-offs between simplicity and safety. Here are the three most prevalent themes, supported by direct quotes from participants.

1. Avoiding Dynamic Memory Allocation for Stability and Simplicity

Many participants advocate for static memory allocation (e.g., pre-allocating on the stack or startup) to eliminate runtime errors and reduce complexity in C programs, especially in embedded or firmware contexts. This approach is praised for making software more predictable and testable, though it's noted as unsuitable for all projects.

"Allocate all memory upfront. Create an allocator if you need to divy it up dynamically. Acquire all resources up front. Try to fit everything in stack. Much easier that way. Only allocate on the heap if you absolutely have to." — agentultra

"I recently changed to try to not use dynamic memory, or if I need to, to do it once at startup. Often static memory on startup is sufficient. Instead use the stack much more and have a limit on how much data the program can handle fixed on startup." — canpan

2. Improving C's String Handling by Replacing Null-Terminated Strings

A recurring suggestion is to move away from null-terminated strings in C, as they lead to pitfalls like buffer overflows and inefficient operations. Instead, length-prefixed strings (using structs with a length and data pointer) are proposed as a safer and more performant alternative, though opinions vary on whether this requires language changes.

"I’ve long been employing the length+data string struct. If there was one thing I could go back and time to change about the C language, it would be removal of the null-terminated string." — WalterBright

"It's not necessary to go back in time. I proposed a way to do it in modern C - no existing code would break... It's simple, and easy to implement." — WalterBright

3. The Trade-Offs of Type Safety and Simplicity in C vs. Alternatives

Debates highlight the balance between C's minimalist, low-level control and the desire for more type safety (e.g., via enums, struct disciplines, or switching languages). Some argue C's simplicity is a strength for performance-critical tasks, while others criticize its fragility and suggest languages like Rust or C# for dynamic needs, rejecting C++ as overly complex.

"The effort and keystrokes that you use to add type safety can only ever increase the complexity of your project. If you're going to pay for it, that complexity has to be worth it. Every single project should be making a conscious decision about this on day one." — BigJono

"If I find myself needing a bunch of dynamic memory allocations and lifetime management, I will simply start using another language–usually rust or C#." — keyle


šŸš€ Project Ideas

CleanSlate

Summary

  • A lightweight browser extension that removes distracting sidebars, pop‑ups, and other UI clutter from any website, leaving only the main content.
  • Core value proposition: restores a ā€œpure, balsamicā€ reading experience, exactly what users like skywalqer and smnplk want.

Details

Key Value
Target Audience Web readers, developers, students, anyone who finds sidebars annoying.
Core Feature Automatic detection of sidebar elements (by CSS selectors, heuristics, or user‑defined rules) and removal or collapse; optional ā€œfocus modeā€ that dims background content.
Tech Stack JavaScript/TypeScript, WebExtension APIs, optional React for UI panel.
Difficulty Low
Monetization Hobby

Notes

  • Users quoted: ā€œI hate it so muchā€ and ā€œthis site is pure balsam for my soul.ā€
  • The extension can be discussed on HN as a minimal UX improvement that solves a common annoyance.

SumGuard

Summary

  • A static‑analysis tool for C/C++ that enforces proper use of sum types (tagged unions), ensuring every tag is handled and fields are accessed safely.
  • Core value proposition: reduces bugs and security issues that arise from unchecked union access, addressing the frustration expressed by matheusmoreira and apaprocki.

Details

Key Value
Target Audience C/C++ developers, security auditors, compiler developers.
Core Feature Detects tagged unions, warns on missing tag checks, offers optional compiler plugin to insert guard checks.
Tech Stack Clang/LLVM libTooling, Rust for CLI, optional VSCode extension.
Difficulty Medium
Monetization Revenue‑ready: subscription for enterprise support and CI integration.

Notes

  • ā€œCoverity has a checker that creates an error if it detects tagged union access without first checking the tag.ā€
  • The tool can be showcased as a practical utility that bridges the gap between language features and compiler enforcement.

ArenaC

Summary

  • A C library that provides arena‑based allocation with compile‑time size guarantees, static pool initialization, and optional bounds‑checking.
  • Core value proposition: satisfies the need for ā€œallocate everything at startupā€ patterns while keeping performance high and memory usage predictable.

Details

Key Value
Target Audience Embedded developers, systems programmers, performance‑critical C projects.
Core Feature arena_alloc(size) with static pool, optional arena_check(ptr) for bounds, API for stack‑like allocation (arena_push, arena_pop).
Tech Stack C11, C++17 for optional wrappers, optional Rust FFI.
Difficulty Medium
Monetization Hobby

Notes

  • ā€œI changed to try to not use dynamic memory, or if I need to, to do it once at startup.ā€
  • The library can be a discussion starter on HN about memory‑management trade‑offs.

ABIShield

Summary

  • A specification and code‑generation tool that defines a safe, language‑agnostic ABI for passing structs, arrays, and tagged unions across language boundaries.
  • Core value proposition: eliminates fragile ā€œstruct layoutā€ hacks and pointer‑validation errors highlighted by convolvatron and adrianN.

Details

Key Value
Target Audience Cross‑language library authors, OS developers, embedded firmware teams.
Core Feature YAML/JSON ABI schema → C/C++/Rust/Go bindings; runtime validation of lengths and tags; automated header generation.
Tech Stack Python, Jinja2 templates, libclang for parsing, optional Rust for runtime checks.
Difficulty High
Monetization Revenue‑ready: paid enterprise license for CI integration and support.

Notes

  • ā€œWe need a way to fix both of those… addresses? Idk.ā€
  • The tool would be a practical utility that addresses a long‑standing pain point in multi‑language projects.

Read Later