r/C_Programming • u/Xadartt • 1h ago
r/C_Programming • u/Jinren • Feb 23 '24
Latest working draft N3220
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3220.pdf
Update y'all's bookmarks if you're still referring to N3096!
C23 is done, and there are no more public drafts: it will only be available for purchase. However, although this is teeeeechnically therefore a draft of whatever the next Standard C2Y ends up being, this "draft" contains no changes from C23 except to remove the 2023 branding and add a bullet at the beginning about all the C2Y content that ... doesn't exist yet.
Since over 500 edits (some small, many large, some quite sweeping) were applied to C23 after the final draft N3096 was released, this is in practice as close as you will get to a free edition of C23.
So this one is the number for the community to remember, and the de-facto successor to old beloved N1570.
Happy coding! 💜
r/C_Programming • u/AutoModerator • 1d ago
Learning C weekly megapost for 2026-12-02
If you have questions about how to learn C:
- which books are best?
- which videos are best?
- which classes are best?
- which websites are best?
- is there a "roadmap"?
- what projects can I do?
then this is the thread for you. Add your question here. Do not make a stand-alone post, as it will be removed.
Remember that our sub has a very useful wiki that has a great list of resources for learning C programming.
r/C_Programming • u/Parking_Impress539 • 7h ago
Review Help with seed generation for RNG.
typedef int8_t i8;
typedef int16_t i16;
typedef int32_t i32;
typedef int64_t i64;
typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef float f32;
typedef double f64;
i8 RANDOM_SEED(){
  static i8 seed = 0;
  static i8 init = 0;
  if (init) return seed;
  FILE *pF = fopen("SEED_FILE", "rb");
  if (pF) {
    fread(&seed, sizeof(i8), 1, pF); Â
  }
  else {
    i8 created = 0;
    srand((u32)time(NULL));
    seed = (i8)(rand() % 246 - 128);
    do { Â
      pF = fopen("SEED_FILE", "wb");
      if(pF){
        fwrite(&seed, sizeof(i8), 1, pF);
        created = 1;
      }
    } while(created != 1);
  }
  fclose(pF);
  pF = NULL;
  init = 1;
  return seed;
}I'm trying to make a seed generator. How it works: you call the function and it creates a seed file with a raw binary value inside it that cannot be read by a human. The program reads it and produces a seed that will always be the same for one computer but will vary from computer to computer. I will use it to make a random number generator whose output is constant on the same machine but differs across machines. Can you tell me if this is efficient, or am I overdoing, underdoing, or overcomplicating things? And also I want to make it memory efficient.
I am making this to clarify my concept on file reading - writing and RNG.
r/C_Programming • u/amadevcode • 16h ago
How to read special characters from a text file?
Hello, I'm doing a little project to improve myself in C. The issue I hit is that non-ASCII characters like 'é' take multiple bytes in UTF-8, so my loop treats them like multiple characters instead of a single one. I don't know how to solve it, can anyone help me with a pretty simple solution because everything that I read online is too complex!
Here is the code if you want to help me:
#include <ctype.h>
#include <stdbool.h>
#include <stdio.h>
int count_words(FILE *file);
int total_char = 0;
int main(int argc, char *argv[])
{
if (argc != 2)
{
printf("Format: ./stats file.txt\n");
return 1;
}
FILE *file = fopen(argv[1], "r");
if (file == NULL)
{
printf("Couldn't open the file %s\n", argv[1]);
return 1;
}
int words = count_words(file);
printf("Words: %i\n", words);
fclose(file);
return 0;
}
int count_words(FILE *file)
{
int n = 0;
char character;
bool word = false;
while (fread(&character, 1, 1, file))
{
if (isspace(character) == 0 && ispunct(character) == 0)
{
if (word == false)
n++;
total_char++;
word = true;
}
else
{
word = false;
}
}
return n;
}Thanks for any help!
r/C_Programming • u/ozuq06 • 20h ago
Discussion Thoughts on safe-c
Has anyone here come across the safe-c project? If so, what do you think of it? If not, do you think a project like this could actually make C (and C++) safer and more attractive in certain fields? Curious to hear what people think.
r/C_Programming • u/FlattenLayer • 9h ago
Project I wrote an AI agent in C: one static binary, no runtime, no Node or Python
What it actually does
Every message is a task. Not a chat bubble you wait on. Tasks have visible states, run in the background, and you keep typing while they work.
Compose tasks like shell pipelines. | passes one task's output to the next, & runs
in the background, ; sequences them, @path#40-80 attaches a line range to the prompt:
"Summarize @design.md in three bullets." | "Turn that into a two-sentence announcement."
Fork instead of re-explaining. /task fork branches a task with its context intact.
Groups and sessions. Groups share conversation history; a session binds groups to a
working directory, so reopening from the same directory picks up where you left off.
/session save then /task resume <id> continues work that was interrupted mid-flight.
Memory and skills. Session memory is searchable across groups. /prompt and /skill
run reusable templates; it already reads .claude, .agents, .opencode and .pi
resource directories, so existing agent configs mostly work.
MCP servers. Streamable HTTP and stdio, configured in ~/.edgeclaw/mcp.json, tools
show up as mcp__<server>__<tool>.
Scheduled jobs. Run a prompt on a cron schedule without keeping a terminal open.
Why C, and what it cost
The goal was curl | sh actually meaning one file. That forces you to build things
yourself instead of pulling a package:
- the input box is a real language (
|,&,;,@path#40-80, quoted text), so it's a flex lexer and a bison grammar — 354 + 400 lines of.l/.y; - TLS and HTTP are mbedtls plus a hand-rolled client, including the SSE stream the MCP client needs;
- state is SQLite, forward-only migrations, no rewriting a JSON blob every turn.
Security matters more than usual here, because the model can run shell commands. On Linux
the sandbox is Landlock for path access plus a seccomp-BPF filter — Landlock doesn't
mediate metadata mutators like FS_IOC_SETFLAGS, so those need seccomp. /sandbox list
shows the resolved writable / read-only / denied sets. On macOS it's Seatbelt.
Numbers, measured on the published binary
- 73.2 MiB as published (71.6 stripped), of which 59.2 MiB is tree-sitter parse tables for syntax highlighting. They're file-backed and demand-paged, so first-screen RSS is 4.7 MB, not 73.
--versionstarts in 0.4 ms; TUI first paint in a PTY in 3-4 ms.- RSS after a long session: ~92 MB (measured with 1793 tasks / 80k messages in the store). Most of that is the TUI's chat model plus glibc arenas, not the grammar tables — only ~9 MB is file-backed.
- 187 cc_test targets, 173/173 green; 69.49% line coverage per Codecov.
r/C_Programming • u/yughiro_destroyer • 1d ago
Flat structures VS nested structures?
Hello!
I have this deep conflict that has been with me for months now. How is it better, flat structures or nested structures? Or what do you prefer?
Flat example :struct entity = {int x = 20;int y = 40;string texture = "mario.png";int current_health = 100;int current_armor = 100;}
Nested example :struct position = {int x = 20;int y = 40;}struct stats = {int current_health = 100;int current_armor = 100;}
struct renderable = {string texture = "mario.png"}struct entity = {position position;stats stats;texture texture;}
I have tried to use nested structures as often as possible because that's the norm but they are becoming a pain in my experience. Mostly, it comes down to boilerplate, the risk of getting paths wrong when there's too much nesting and theoretical purity where I find that a property would've worked better in another component.
But with flat structures? I get much better results, more directness, easier debugging and less cognitive load as a property is defined in only one way, even if the names get longer or repetitive. Also, that's how computers like to think and as a CS engineer, I learned how computers think before learning how humans program so I lean towards more old school polling / procedural algorithms.
If I were to make an analogy of how that makes me feel, it would be like owning a big tools box. When I open the box, I can instantly see and pick or place the drill, the screwdriver, the screws and whatever else is there. But with nesting... if feels like after opening the tools box, that the drill has it's own mini-box, that the screws are in another box and so on. I prefer seeing the whole picture at once instead of always having to deal with involvement at micro-scales of a big thing.
Also, I noticed that older games like Doom are closer to flat structs. The thing is, my game isn't very complex in terms of gameplay and it features multiplayer matchmaking. And it's on the server side where I noticed that a flat structure would be much easier for debugging, serialisation and overall faster development speeds.
r/C_Programming
•
u/Kabra___kiiiiiiiid
•
2d ago
Article Zero-initialisation shenanigans
napcakes.nekoweb.orgr/C_Programming • u/Zeta_ggwp • 1d ago
Question Need help avoiding circular dependency
[Solved but I'll gladly accept new solutions]
I am making a small clone of asteroids on C and plan to use the observer pattern described in Game Programming Patterns by Bob Nystrom. (Adapted to C) To do so, I currently have 2 files, a stats system (stats.h/c) and the actual observer pattern code (event.h/c). (Relevant Source code below)
My problem is that stats.h/c requires access to structs and enums defined in event.h, but event.h has a struct that contains a union with a struct defined in stats.h, and I don't know how to solve the circular dependency.
stats.h and stats.c (implementation of statsOnNotify lies in C file)
struct Stats { ... };
// statsOnNotify requires struct Observer and enum EventType, defined in event.h
void statsOnNotify(struct Observer \*observer, enum EventType event, void \*data) {
switch (event) {
case ...: {
//Access Observer union to access the struct Stats data
}
break;
}
}event.h
enum EventType { ... };
struct Observer;
// Requires struct Observer and enum EventType.
typedef void (\*NotificationHandler)(struct Observer \*observer, enum EventType event, void \*data);
enum ObserverType { ... };
// struct Observer requires struct Stats, defined in stats.h
struct Observer {
enum ObserverType type;
union {
struct Stats stats;
} data;
NotificationHandler onNotify;
};r/C_Programming • u/_Geolm_ • 23h ago
GitHub - safe-c-project/safe-c: C and C++ with memory safety guarantees as strong as Rust
Hi, I'm not the author of this repo but I find it interesting to say the least, I've already followed Fil-C progress but I will try safe-c on my project for sure and give some feedback.
r/C_Programming • u/hnat_lesiv • 1d ago
Streamside: a native C viewer for Twitch, Kick, and YouTube Live with embedded chat
Sharing a C project I've been working on: a single-window viewer for Twitch, Kick, and YouTube Live streams + chat without Electron, Python, or yt-dlp.
It embeds libmpv into an SDL2/OpenGL window alongside a custom chat pane (Twitch IRC over WebSocket, Kick Pusher WebSocket, YouTube InnerTube polling, plus inline emote/emoji rendering) and resolves HLS directly with libcurl. Builds statically on Linux and cross-compiles to a standalone Windows exe with mingw-w64.
Demo + MIT source tarball here: https://streamside.lessif.org/
Feedback on the code or build setup is welcome.
r/C_Programming • u/tomatofoo • 2d ago
Project I Made a 3D .OBJ Viewer with Software Rendering and a Custom Parser
To get better at computer graphics, I created a .OBJ file viewer that uses software rasterization and only depends on SDL3 and its child libraries. It supports materials, texture mapping, Phong shading, Phong illumination, and near clipping.
This is my first big C project, so any feedback / constructive criticism is appreciated (especially on the code).
No AI was used.
r/C_Programming • u/Maqi-X • 1d ago
Project I wanted a modern alternative to C, so I started building Elash
So, I like C. I like how simple it is and I just like using it. I'm tired of overcomplicated languages. But of course C is not a perfect language. There are so many features I'd really like to have. So many things that could be improved or redesigned in a better way. So many bad decisions and suboptimal tradeoffs.
If you don't care, you can just scroll to "The Elash language" section. I know I should've show some code example here to actually get you interested but I currently don't have much to show. But... here's a "game" made with SDL3 in Elash!
My problems with C
I'm very happy with C's philosophy, but there are some things I've always wished it did differently.
- Native tagged unions: In C, you usually build them as a struct with an enum tag plus a union (or use tricks like a common tag header in every variant). All of these require a lot of boilerplate, and there's no pattern matching. I don't think full pattern matching is strictly necessary, but I'd LOVE something like
if (SomeVariant v = my_union) use(v);. In C it's more likeif (my_union.kind == MYUNION_SOME_VARIANT) use(my_union.as.some_variant);, and you repeat the field name every time. However you define it, it's never as convenient as a built-in tagged union, and the compiler can't enforce safety or stop you from accessing random fields before checking which one is actually active. - Optional types: For an optional int in C, you use a sentinel value such as 0, -1, or maybe even
INT_MAX/INT_MINdepending on which values you don't need. If you really need the whole range, you can wrap it in a struct with abool has_value;field, which is really inconvenient, at least for me. On the other hand, we have pointers, and they have the standardNULLconstant, but the problem is every pointer is "optional": there's no way to encode a pointer that can't be NULL in C's type system, so you rely on comments and docs, and the compiler doesn't read those or enforce them. There are compiler-specific "solutions" like__attribute__((nonnull)), but that's just not the same thing. - More advanced preprocessor: Many people will disagree, but I think the concept of a preprocessor separate from the core compiler is a great thing. But CPP is very limited and requires hacks if you want to use it for something more complex. It doesn't support recursion and iteration in a normal way and it cannot evaluate expressions (I mean, it can, but only in
#ifdirectives). - Slice types: To declare a function that takes a slice you usually write
(int* xs, size_t count), and to store one you need two struct fields likethingsandthings_count. That's inconvenient. It's much better to store a slice in one variable without defining your own struct every time you need a slice of a type that doesn't already have one. Andint[] xslooks better thanIntSlice xs(: - Declaration syntax: No need to explain. It's just terrible. But people don't get why. It's not because the type comes before the variable name. You can design readable, consistent type-first syntax. What separates good and bad declaration syntax is whether it reads naturally left to right or right to left without parentheses. Just reversing C's syntax doesn't make it readable.
(*signal(int, (*)(int): void)): voidisn't any better thanvoid (*signal(int, void (*)(int)))(int);. Butvoid(int)* signal(int, void(int)*);is, because it reads cleanly left to right. Typedefs only partly solve this, and there are still footguns likeint* x, y;. - Weak type aliases: Typedefs in C are only aliases. You can use the typedef and the original type interchangeably. You can wrap the type in a struct, but then you lose access to operators etc. It would be nice to have some way to define "strong type aliases", like in Go.
- No defer: Pretty obvious,
deferstatements are really useful and C just doesn't support them. If you follow recent C standards you may know that this feature is slated for C29, but that standard will be released around 2029 and it'll take a few more years before it's production ready.
There are so many other examples, that I will not explain all of them, but a few more examples are: Bad standard library, No built-in collections, char vs unsigned char vs signed char, Built-in string views, Arrays as first class values, Loops over collections, Embedding files at compile time (C23 added #embed but most compilers don't support it yet), Anonymous functions, Implicit narrowing conversions, ...
The Elash language
I know of C3, Zig and other languages that tried to "replace C" but none of them is quite what I wanted, and also I want[ed] to learn langdev and compiler architecture, so I decided to create my own programming language, called Elash (the name doesn't mean anything, it just sounds cool).
It obviously won't "replace C", and that was never the goal. As I already said, I wanted to learn compilers architecture and experiment with designing my own language just how I want to.
It's meant to be a really simple, relatively low-level language that is [semi-]familiar to C developers, convenient to use, and fixes the issues listed above.
I started the project about 9 months ago, I took a couple of breaks but I was working on it regularly for a very long time, initially with a friend of mine but later I became the only maintainer. The project isn't finished. In fact, it's still in the early developement stage, though it's already (kind of) usable for simple tasks. Writing a programming language takes time and you can’t just finish it in a week like many vibecoded languages posted here and on other subreddits.
The compiler is written in C using the LLVM C API (it's built as a multi backend compiler from the start though currently LLVM is the only backend)
I'm looking for people interested in the project; if you want to contribute to the language, share your ideas or just see how development is going, you might want to join the Discord server I've just created. And here is the GitHub repository.
r/C_Programming • u/Bratan_Corporation • 2d ago
I built CLAP to make it easier to compile a C file on Windows
I maintain CLAP, an open-source command-line frontend for C and C++. The use case is a small C program on a fresh Windows machine. With Python installed, you can install CLAP with `python -m pip install clap-compiler` and build a local `main.c` with `clap build main.c -o hello`. If needed, CLAP downloads a pinned Zig/Clang toolchain on the first build. It also supports multi-file projects and CMake.
I’d like feedback from people who teach or learn C on Windows. What would you expect a tool like this to show when the first build fails, and what would make the compiler setup easier to understand?
Source and examples (MIT): https://github.com/BRATAN-CORP/clap
c now is easy, as never before...
r/C_Programming • u/masiroo • 2d ago
Project HimitsuObfuscator: Whitelist-driven C/C++ obfuscator with LLVM 17
Obfuscation can cause build errors or unexpected runtime behavior when transformations are applied too broadly.
I built each obfuscation pass around a whitelist, so only instructions considered safe for each transformation are selected.
It supports Linux on x86_64 and aarch64, with control flow flattening, bogus control flow, instruction substitution, string encryption, and basic block splitting.
r/C_Programming • u/Alcacholaruz • 2d ago
Project Wrote a multi-core-native, SIMD lossless compression codec, originally for my engine, but just released to github with permissive license!
Hey everyone,
I originally built this compression algorithm for my own game engine because I wanted an open-source middle ground between LZ4 and Zstd for game dev workloads (paks, streaming assets, snapshots, small netcode packets). Full disclosure: I have background in network and low-level optimization, and I used AI to help me bridge the domain gap in compression itself while steering the architecture, profiling, and verifying everything on real hardware.
It turned out useful enough that I split it into a standalone zero-dependency library + CLI in both C11 and native Odin (100% wire-compatible, Apache-2.0, Linux/macOS/Windows):
https://github.com/JoseIgnacioAragon/axz
Quick numbers on the standard 202 MiB Silesia corpus (Intel Core 7 240H, AVX2, in-memory):
AXZ -1:2.21x|3.36 GiB/s1T /17.0 GiB/s16T decodeAXZ -5:2.90x|3.24 GiB/s1T /17.0 GiB/s16T decode (matchesZstd -1ratio while decoding ~2x faster 1T and ~11x faster 16T, since standard Zstd frames don't parallelize decode)- On a 32T Ryzen 9 7950X (AVX-512VBMI2) it scales up to 58 GiB/s multi-core decode.
It's multi-core native in the wire format, skips bit-level Huffman/ANS in favor of SIMD planar tables, and includes 11 per-chunk pre-filters (RGBA8, Float4_Xor, Delta, SoA, etc.) plus 8-byte micro-packets + 8 KiB dictionaries for small RPC/netcode payloads. ARM64 NEON isn't in yet (runs scalar fallback for now), and -5 is intentionally slow to encode for offline asset cooking.
r/C_Programming • u/NazgulResebo • 3d ago
Video Coding a fractal Kaleidoscope using C & GLSL
In this video I create a classic kaleidoscope fractal animation using Raylib, C and GLSL.
I follow these steps:
- First, I split the screen into slices (like a pizza) using polar coordinates.
- Then, I create a well-known pattern in fractal shaders: sin(x) * sin(y), inside each slice.
- Next, I add a color palette to generate some nice colors.
- Finally, I use time as a parameter in different parts of the shader to animate both the pattern and the colors.
Source code:
https://github.com/FractalCodeRicardo/zen-programming/tree/main/kaleidoscope
C part
#include <raylib.h>
#define size 800
float time = 0.0;
int main() {
InitWindow(size, size, "Kaleidoscope");
Shader shader = LoadShader(0, "kaleidoscope.glsl");
int timeLoc = GetShaderLocation(shader, "time");
while(!WindowShouldClose()) {
time = GetTime();
SetShaderValue(shader, timeLoc, &time, SHADER_UNIFORM_FLOAT);
BeginDrawing();
ClearBackground(BLACK);
BeginShaderMode(shader);
DrawRectangle(0, 0, size, size, BLACK);
EndShaderMode();
EndDrawing();
}
CloseWindow();
}GLSL part
void main() {
float pi = 3.1416;
vec2 uv = gl_FragCoord.xy / 800;
uv = uv - 0.5;
float angle = atan(uv.y, uv.x) * time * 0.3;
float radius = length(uv);
float slices = 3;
float size = pi * 2 / 3;
float internal_angle = mod(angle, size);
internal_angle = abs(internal_angle - size /2.0);
vec2 internal_point= radius *
vec2(
cos(internal_angle) * radius,
sin(internal_angle) * radius
);
float pattern =
sin(internal_point.x * time *10 * 0.5) *
sin(internal_point.y * time *10 * 0.5);
vec3 c = palette(pattern + time * 0.5);
color = vec4(c, 1);
}AI Disclaimer:
I used AI to understand the fractal then I coded my own version
r/C_Programming • u/Content-Try2761 • 3d ago
C beginner
hello, i love the c programming language, and i want someone that is also a beginner like me to help each other get better, right now working on a project "text editor"
r/C_Programming • u/space_junk_galaxy • 3d ago
Question Design choice with enums and strings
I'm working on a C minecraft clone, and I've been refactoring a bunch of my block code. Previously a "block" was just an enum, I essentially "hardcoded" the list of blocks in the game itself. Part of the refactor is using a JSON file for defining blocks and their metadata. However, because of this, I've now reached a weird place. The JSON defines the ID as a string. The enum that was BLOCK_GRASS is now a string in the JSON as "BLOCK_GRASS".
The design question I have is should I be referencing a string in my code, and doing comparisons with strings? Or do I need to have some sort of intermediate mapping of string IDs -> enum IDs. The latter seems kind of wasteful since it just means all the benefits of the JSON config file went away.
Not sure what the general consensus is. The strings are going to be in the data section anyways so I don't think I'm being wasteful with allocations here.
r/C_Programming • u/Ok-Counter-6984 • 4d ago
Question What is the most high-level C feature in your opinion?
I'm asking this purely out of curiosity.
I've been programming in C for a couple of years now, and I recently dived into some x86-64 assembly. I was surprised by how similar some asm concepts were to using C. Known by some as a "portable assembler", C is probably one of if not the most low-level language one can use that is not raw assembly language.
But what is the most high-level feature C supports? Standard library features do not count.
Honestly? I think it has gotta be structs / unions, right? Sizeof is really powerful and having automatic variable offsets that adapt as you upgrade your code is something I totally missed quite a lot when using MASM.
r/C_Programming • u/Dark-ness-1 • 3d ago
looking for modern c text editors
ive been writing c for 6 months now and i keep on hopping onto different ides and text editors because frankly i dont really like them, i have been using vim , neovim , codium and vscode, code::blocks, codelite but i dont really like them especially the last 2. they have a retro look to them and im not a fan. vscode is too heavy for me considering i use a 4gb ram laptop on void linux so im guessing there arent many choices for me in terms of aesthetics but im hoping anyone can help me finally settle down
r/C_Programming • u/KanatoreIT • 4d ago
SOVDEFLATE: A zero-dependency DEFLATE/ZLIB/GZIP engine written from scratch in C11 with AVX2, BMI2, and AVX-512 VNNI
Hi everyone,
I’ve been working on SOVDEFLATE, an in-house DEFLATE (RFC 1951), ZLIB (RFC 1950), and GZIP (RFC 1952) compression and decompression library written from scratch in C11 with zero third-party dependencies (only the C standard library and OS thread APIs).
Repository: https://github.com/KanatoreIT/SOVDEFLATE
Key technical details:
- Runtime SIMD dispatch: Selects between scalar baseline, BMI2, AVX2, and 256-bit AVX-512 VL + VNNI (for Adler-32) at startup.
- PDF stream handling: Includes sovdeflate_decompress_prefix and an incremental decoder that stops cleanly at the end of a stream without consuming or rejecting trailing bytes (like \nendstream in PDFs), reporting exact bytes consumed.
- Damaged stream recovery: Recovers partial bytes from corrupted streams matching zlib behavior (tested across 11,982 damaged streams).
- Optional C++20 header-only wrapper (sovdeflate_cpp20.hpp) and custom memory allocator with byte limits.
Honest benchmarks (2,000 real DocLayNet PDFs / 445.5 MB uncompressed, i5-11400H):
- Decompression (1 thread): 713 MB/s (vs. 738 MB/s in libdeflate 1.26 — about 3.5% behind).
- Decompression (12 threads): 5,310 MB/s (vs. 6,037 MB/s in libdeflate 1.26).
- Compression (DEFAULT / level 6): 77.7 MB/s at 1.000× size (vs. 46.8 MB/s in zlib 1.3.2 and 127.2 MB/s in libdeflate).
Compression speed is still behind libdeflate and is my main focus for the next iteration. The repo also includes an originality audit script checking against zlib, zlib-ng, libdeflate, miniz, and stb, plus ASan/UBSan test scripts.
I’d love to hear any feedback on the C11 implementation, SIMD paths, or ideas to close the compression speed gap!
r/C_Programming • u/CAPTAINCAPSLOCK111 • 5d ago
When is a small C function worth putting in a header as static inline?
I’m splitting some graphics code into smaller .c and .h files. For tiny maths functions called frequently, how do you decide between a normal function in a .c file and static inline in the header? Do you measure a difference before moving them?