|
1 | 1 | # Why NextStd? |
| 2 | + |
| 3 | +C is the undisputed language of the physical and systems world. |
| 4 | +Whether you are building real-time camera processing pipelines, |
| 5 | +writing constrained firmware for microcontrollers like the ESP32 |
| 6 | +and RP2040, or crafting lightning-fast terminal applications, C gives |
| 7 | +you the raw, uncompromised control you need. |
| 8 | + |
| 9 | +But that control comes with a massive, decades-old hidden cost: |
| 10 | +**The Standard Library.** |
| 11 | + |
| 12 | +## The Legacy C Trap |
| 13 | + |
| 14 | +Libraries like `<stdio.h>`, `<string.h>`, and `<stdlib.h>` were designed |
| 15 | +in an era before cybersecurity was a primary concern. Today, they are |
| 16 | +the root cause of the majority of software vulnerabilities. |
| 17 | + |
| 18 | +Consider a standard C input operation: |
| 19 | + |
| 20 | +```c |
| 21 | +int age; |
| 22 | +printf("Enter your age: "); |
| 23 | +scanf("%d", &age); |
| 24 | +``` |
| 25 | +
|
| 26 | +If a user types `"twenty"` instead of `20`, `scanf` silently fails, |
| 27 | +leaves the invalid text in the input buffer (corrupting future reads), |
| 28 | +and leaves `age` uninitialized. If you try to concatenate two strings using |
| 29 | +`strcat` and miscalculate the buffer size by a single byte, you trigger a |
| 30 | +buffer overflow. If you pass a `NULL` pointer into `strlen`, your entire |
| 31 | +system crashes with a Segmentation Fault. |
| 32 | +
|
| 33 | +In mission-critical environments, a single uncaught `NULL` pointer can brick a |
| 34 | +device or crash a production system. |
| 35 | +
|
| 36 | +### The Rewrite Dilemma |
| 37 | +
|
| 38 | +The modern industry answer to C's unsafety is to rewrite everything in Rust. |
| 39 | +
|
| 40 | +Rust is incredible. It mathematically proves memory safety at compile time. |
| 41 | +However, rewriting massive, established C codebases, or trying to interface |
| 42 | +Rust with highly specific hardware vendor SDKs, is often unrealistic, expensive, |
| 43 | +and time-consuming. |
| 44 | +
|
| 45 | +Developers shouldn't have to abandon their C codebases just to get modern safety |
| 46 | +guarantees. |
| 47 | +
|
| 48 | +## The NextStd Bridge |
| 49 | +
|
| 50 | +**NextStd** was built to be the bridge. It is a drop-in systems library that |
| 51 | +brings the fearless safety of Rust directly into C, using standard Foreign |
| 52 | +Function Interface (FFI) boundaries. |
| 53 | +
|
| 54 | +With NextStd, you don't rewrite your C code; you just upgrade your tools. |
| 55 | +
|
| 56 | +* **You keep** your C compiler, your Makefiles, and your existing architecture. |
| 57 | +* **You replace** dangerous functions like `printf` and `scanf` with |
| 58 | +`ns_print` and `ns_read`. |
| 59 | +* **You gain** compile-time type routing, `NULL` pointer immunity, |
| 60 | +safe heap allocation, and Python-style `TRY/EXCEPT` error handling. |
| 61 | +
|
| 62 | +By handling the most dangerous operations (I/O, string manipulation, |
| 63 | +and dynamic memory) in a memory-safe backend, NextStd allows you to write |
| 64 | +C code that is fundamentally immune to standard library footguns. |
| 65 | +
|
| 66 | +You get the speed of C, with the peace of mind of Rust. |
0 commit comments