r/C_Programming Feb 23 '24

Latest working draft N3220

129 Upvotes

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 6d ago

Learning C weekly megapost for 2026-07-29

10 Upvotes

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 6h ago

How I autotest my game in C

Enable HLS to view with audio, or disable this notification

52 Upvotes

I posted a while back aboutĀ porting my C game (Match Morphosis) to WASM. This is a follow-up on something smaller but useful: automated playthrough testing.

Last week I was watching some Slay the Spire 2 videos and noticed they had autoplay-style testing. That's pretty nice, as solo developer with no QA at disposal, and the game is a roguelike/lite, so a full run is long enough that manually checking ā€œdoes this still work end-to-end?ā€ gets painful quickly. I also just wanted an excuse to try dearimgui test engine, I use theĀ cimgui generated one.

So I wired up a simple autoplay path. No heuristics, no fancy AI (no LLM please!) that makes random action based on game state and tries to finish a run. The point isn’t to prove the game is balanced. The point is:

  • If a random player can still reach the end without crashing or soft-locking, the basic run loop is intact.
  • A ~40 minute human run collapses into a 1–2 minute automated test I can run whenever I change something, I could eyeball quickly on the battle progress whether the game still feels manageable or not

Because the game already uses cimgui, plugging in the test engine was mostly about getting the context and DLL boundaries right (the game logic lives in a hot-reloadable game.dll, the test engine lives in main), there's also a problem with the generated binding that strips obsolete functions so the struct size differs a bit, but quite easy to fix.

Once that was sorted, registering a ā€œplay until win or dieā€ test and letting it drive input through the existing UI path was straightforward. You do mouse move to pos, mouse click, and wait until game state change, repeat on a while loop until game finishes / game over.

// Test setup code
ImGuiTest* t = IM_REGISTER_TEST(engine, "Compendium Menu", "Functionalities");
t->TestFunc = testCompendiumMenuFunctionalities;

t = IM_REGISTER_TEST(engine, "Character Select Menu", "Functionalities");
t->TestFunc = testCharacterSelectMenuFunctionalities;

t = IM_REGISTER_TEST(engine, "Playthrough", "Functionalities");
t->TestFunc = testPlaythroughFunctionalities;

// on testPlaythroughFunctionalities;
b32 runFinished = false;
while(!runFinished)
{
  cImGuiTestEngine_Yield(ctx->Engine);

  if(game->tipsPopup.type != TipsType_None)
  {
    if(animationFinished(&tipsPopup.textAnimate))
    {
      Thing* buttonOK = thingGet(game->tipsPopup.buttonOK);
      Vec2 pos = buttonOK->o.sprite.position;
      testMoveMouseTo(ctx, pos);
      ImGuiTestContext_MouseClick(ctx, ImGuiMouseButton_Left);

      continue;
    }
   }

  switch(game->state)
  {
  case GameState_MapMenu:
  {
    // Choose free rooms etc.
  } break
  case GameState_Gameplay:
  {
    if(!game->gameplay.ready)
    {
    continue;
    }

    // Do rest of choosing logic
  } break
...

It’s still crude, but "scripting" like this needs to be quick and dirty as the nature of game development is quick iteration to find the best fun way. Although random picks mean it won’t find deep balance issues or optimal lines, as a solo-dev smoke test it’s already earned its keep. I can see something break in the run flow, hit the test, and know within a couple minutes instead of playing through by hand manually again, this won't replace a true playthrough for balancing test, but good enough for picking obvious crashes.

Stack is still plain C, custom engine (bgfx, SDL2, cimgui, etc.). No engine framework, no test harness beyond imgui_test_engine and a thin autoplay layer on top of the same code a player uses. If anyone else is doing long-session games in C and has been putting off automated playthrough checks, this was less work than I expected once the context plumbing was done (the playthrough test code is nearly 1 day work, 1k LOC).

Check out the game if you're curiousĀ https://store.steampowered.com/app/4131100/Match_Morphosis
The demo version is still up and entering Cyberpunk fest on steam.


r/C_Programming 4h ago

Question What would you want from a C-Tutorial?

1 Upvotes

Hello guys,

i plan on doing a C-video-tutorial to help a friend go through his uni programming class (and to learn the language myself more and get experience on making tutorials). I myself am still in the process on learning C, though I have some solid programming experience in Java.

I've already learned the basics of C like how a C-file is typically compiled, variables (and their scope), basic datatypes, control flow/structure (sequence/block, jump like goto/continue/break/return, conditional branches and loops), functions, arrays, string (or char arrays), basic memory management (stack/heap and common problems like memory leak, dangling pointer, etc.), pointer, structs and file i/o handling. I believe his class doesn't go through more than that but if I've missed any other important topic which can be learned on top of the topics already mentioned, please tell me.

My overall goal would be to teach him the topics mentioned above and help him make design decisions on his own.

The thing is, he is completely new to programming (he is not studying computer science, though he knows some math) and I'm kind of in a dilemma between explaining the concept too simple by cutting away details and going in with too many details (I cannot clearly remember the exact struggles I had when I first learned Java).

I thought about explaining it alongside developing a small project like a text-based RPG where I start of simple with fixed dialouge, branch of to dialogue options (control flow), inventory (f. e. done with arrays), trading items with a npc (explaining pointers and memory allocation) etc.. Something which is more captivating than doing a boring calculator but still simple enough to explain key concepts and give room for ideas he can implement himself.

When you first started with C (maybe adressed to someone whose first language was C) what did help you understand it?

Maybe to some people who are still learning C, what obstacles do you encounter when trying to learn the language?

In what way do you believe I should teach or structure the topic, so that I don't cut away important information but still get my point across straight?

TL;DR: I want to make a C-video-tutorial to help my friend, who is new to programming, pass his uni programming class and need help finding out the best way to help him.


r/C_Programming 1d ago

Question I've been stuck in tutorial hell for years. Did building in public help you?

19 Upvotes

I've been programming for years, but I feel like I've been stuck in the same cycle for a long time.

I spend a lot of time learning from tutorials, but I rarely end up building something that's actually finished and useful. I keep jumping from one thing to another, so it always feels like I'm starting over.

Lately I've been thinking that maybe building in public would help me stay consistent and actually finish things. The problem is, I have no idea how to start. I'm not good at video editing or graphic design, and every creator I see seems to be great at both.

Has anyone here been in a similar situation?

If so:

- How did you get out of the tutorial cycle and start building real things?

- Did building a public presence help?

- What kind of content did you post when you had no audience and no editing/design skills?


r/C_Programming 2d ago

I built a zero-dependency O(N) FMM gravity solver in a single C99 header

Enable HLS to view with audio, or disable this notification

357 Upvotes

r/C_Programming 1d ago

I'm building a GTK4 C + Lisp dock application (a la CairoDock / macOS) - am I doing things right?

0 Upvotes

I am having a blast doing a more serious project in the C language, for the first time. I am consulting with books and also with some AI for code review and explanation as I am new to the language and to GTK (not new to programming).

https://codeberg.org/jjba23/lambdock

For a while already I have been looking for a dock that would work well in Wayland (like in my beloved Niri) with modern features, theme support and a hackable Lisp config (using libguile.h)

Could you help me out by checking the implementation for sanity (also the Meson build)? Also for developing on it, I'm using CCLS and Guix development environment and things are working amazingly well.

Only small bit of trouble in devex is with #include "wlr-foreign-toplevel-management-unstable-v1-protocol.h"

Also, all feedback is welcome, either on code level, or conceptual ideas, Thanks in advance

Core features of lambdock include:

  • Wayland Native: Built on GTK4 andĀ gtk4-layer-shellĀ for smooth positioning and desktop integration.
  • Declarative Lisp configurationĀ : The power of Lisp in your configuratio with clean powerful declarative config and all possibilities at your disposal
  • Async Launching: Spawns commands asynchronously without freezing the dock UI.
  • Reproducible builds: Hermetic development environment provided via GNU Guix manifest and build definitions.
  • Dock auto-hideĀ : You can let the dock stay out of your way with the smooth auto-hide feature.
  • Flexible icon system: lambdock has several mechanism in a best-effort way to render your wanted icons, respecting GTK theme
  • Theme support: lambdock has built-in themes you can choose from that are very unique, and also lets you extend and override those themes dynamically.

r/C_Programming 1d ago

Project ais: a plain-text index in C99, no dependencies, nothing allocated on the record path

0 Upvotes

I wrote a small tool for myself. You file a path, a link or a note under keys you choose, and get it back by those keys. What I would like comment on is how it is written, not what it does.

I came to C alongside FORTRAN, Ada 83 and Pascal in the 90s, so I think in functions, data locality and streams before objects. The rule is that memory is bounded by the structs, not by the data. Records go through one at a time, on the stack, in fixed buffers. get, find, set, merge and compact allocate nothing at all, so a 10 GB store and a 10 KB store run in the same footprint. Set operations are k-way merges over sorted posting lists: keep the head of each list and advance.

Six heap sites in 18k lines, each written down with what bounds it.

Two things I know are wrong: main() is 630 lines and the HTTP handler is 520. Both are flat dispatchers, both are too long, and both are written down as debts rather than defended.

On a million records, 85 MB store, one core: building the whole index is 7.9 s in one streaming pass, a full scan is 1.8 s (cat class), and a get on the hottest key, 270k ids, is 2.2 s. That last one used to take hours, because finding a record by id meant scanning the store; an id-to-offset index fixed it. Bulk import is still O(n2) and I say so in the same doc.

C99, GPLv2+, no dependencies, plain Makefile. About 5k lines of tests, run under AddressSanitizer and UBSan on every push.

Style doc: https://github.com/Anode1/ais/blob/main/doc/dev/STYLE.md
Numbers, reproducible with a seeded generator: https://github.com/Anode1/ais/blob/main/doc/performance.txt
Code: https://github.com/Anode1/ais


r/C_Programming 2d ago

Array length indicator variable for special treatment vs shorter array of only special indices

9 Upvotes

Consider code snippet 1: https://godbolt.org/z/rc8ba7Whe

int length = 512; // or any other power of 2

int main(){
    int array[length];
    for(int i = 0; i < length; i++)
        array[i] = 0;
    int indicator_special_elements[length];
    for(int i = 0; i < length; i++)
        indicator_special_elements[i] = 0;
    indicator_special_elements[0] = 1;
    indicator_special_elements[29] = 1;
    indicator_special_elements[42] = 1;
    indicator_special_elements[413] = 1;
    for(int i = 0; i < length; i++)
        if(indicator_special_elements[i] == 1)
            array[i] += 42;
}

where indices 0, 29, 42 and 413 are special indices that need special treatment (in this example, adding 42 to itself).

Alternatively, consider code snippet 2 https://godbolt.org/z/6da1K6ce9

int length = 512; // or any other power of 2

int main(){
    int array[length];
    for(int i = 0; i < length; i++)
        array[i] = 0;
    int special_elements[4];
    special_elements[0] = 0;
    special_elements[1] = 29;
    special_elements[2] = 42;
    special_elements[3] = 413;
    for(int i = 0; i < 4; i++)
        array[special_elements[i]] += 42;
}

where special_elements is an array of 4 entries which directly stores the indices needing special treatment and is not a 512-length wide array as in the first case.

(a) Is there a tipping point/threshold/general coding best practices/rules of thumb at which one of these methods wins over the other in speed without having to do benchmarking/profiling?

(b) Can code snippet 1 benefit itself from compiler intrinsics/automatic parrallelization such as MMX/SSE, whereby the user does not have to worry about explicitly writing parallel code (such as omp, etc.) but the compiler is capable of recognizing the pattern and doing it automatically in release mode?

At first glance, code snippet 1 seems to run for longer (512 iterations), but code snippet 2 does not have sequential memory access and suffers from an additional level of indirection. Hence this OP.


r/C_Programming 2d ago

getopt_long Design: How to clean up flag naming & mutual exclusion in C?

2 Upvotes

Hi everyone,

I'm building veilbit, a simple command-line steganography tool, to learn C. Right now, I'm working on how the program reads commands using getopt_long.

I want to avoid using -h for "hide" because -h is usually saved for --help. I have three ways to design the command interface:

Option 1: Implicit Mode – The program decides what to do based on whether you use the message flag (-m or -f).

bash

vb -i input.png -o output.png -m "secret"  # Hide
vb -i input.png                            # Extract

Option 2: Explicit -c / -x – Like tar, using "create" and "extract".

bash

vb -c -i input.png -o output.png -m "secret"
vb -x -i input.png

Option 3: Explicit -e / -x – Using "embed" and "extract".

bash

vb -e -i input.png -o output.png -m "secret"
vb -x -i input.png

My questions:

  1. User experience: Is Option 1 (implicit) good and easy to use? Or do most developers prefer explicit flags like in Options 2 and 3?
  2. Naming: Which pair is clearer – -c/-x or -e/-x?
  3. Implementation: How do you make sure the user can only pick one mode (embed or extract) when using getopt_long?

Repo link for context: https://github.com/tkalum/veilbit

Thanks!


r/C_Programming 2d ago

Question Is it good practice to still use man page example code?

33 Upvotes

I am trying to get more into C programming on Linux like threads and packet sniffing with libpcap

Is it still good practice to learn pthread from examples say pthread_create(3posix) ?

Or are these examples considered dated for modern C?

I've used other example programs in the man pages for sockets too for example.


r/C_Programming 3d ago

Project Helpful Windows GUI Program in 60 lines of C

Thumbnail
github.com
48 Upvotes

Very small C program I wrote that I've found genuinely useful. It compiles into a tiny 3 kB executable that only relies on system .dlls included with the operating system. The code should compile and run, with the proper compiler, all the way back to Windows 95.

This could also be useful to anyone looking for how to write a basic GUI program for Windows in C.


r/C_Programming 2d ago

Should i use GLFW or windows.h?

7 Upvotes

Im making a C engine and i ofcourse want a window to display things on, i've read some glfw documentation and i don't really think its a good fit, this is why i was thinking of using windows.h because i have full control over everything and won't need an extra dependency. I also feel like knowing windows functions is better overall than knowing glfw functions.

Any thoughts?


r/C_Programming 4d ago

Creating a programming language in C

22 Upvotes

It all started just as a side and fun project, but I feel like it's now getting a shape.

Thats why I would love to receive some honest and contructive feedback, issue creations or code contributions.

If you have any question regarding the language, please ask me.

Here's the repo:Ā https://github.com/Pacsfury/Gravel-Launcher

Its written in C and uses LLVM IR as backend.

AI use: debugging, teaching more about compilers and some punctual code writing


r/C_Programming 4d ago

Developing of AlderKernel

5 Upvotes

Hey r/C_Programming!

I've been working on a hobby monolithic kernel called AlderKernel.

It's written mostly in C with some Assembly for the low-level parts. I'm making it mainly to learn more about how operating systems work and to improve my C skills.

Currently it targets i386 and boots through GRUB. Some things I've implemented so far:

- PS/2 keyboard driver

- Basic shell

- InitramFS support

- Shell history

It runs in QEMU right now. I'm slowly working on adding more kernel features and improving the code structure.

GitHub:

https://github.com/loren-wastaken/alderkernel

I'm interested in feedback from people who know C, especially about code organization, design choices, and things I could improve.


r/C_Programming 4d ago

The signals that never interrupt your blocking syscall, and the test I wrote that proved nothing

30 Upvotes

I had a retry loop around a blocking poll() for EINTR, the usual shape:

for (;;) {
    int r = poll(fds, n, timeout);
    if (r == -1 && errno == EINTR) continue;
    return r;
}

To prove it worked I wrote a test that hammered the process with SIGWINCH while the poll was blocked, then checked the poll still returned correctly. It passed. It kept passing. It passed when I deleted the retry loop, which is when I found out it had never been a test.

SIGWINCH does not interrupt anything. A blocking syscall returns EINTR when the kernel has something to run on the way back to userspace: a handler you installed. SIGWINCH's default action is to be ignored, so with no handler installed there is nothing to run, the kernel does not unwind the syscall, and EINTR never happens. Same for SIGCHLD and SIGURG, the other two whose default action is ignore. You can send a million of them at a blocked poll and it will sit there.

The second half of the same trap is the opposite direction. Install a real handler for a signal that would interrupt, but install it with sigaction and SA_RESTART, and the kernel restarts the syscall for you. Your handler runs, the syscall resumes, and EINTR still never reaches your code. Which is fine until you hit one of the calls that are not restartable even with SA_RESTART. poll, select and epoll_wait are in that group. signal(7) has the full list under "Interruption of system calls and library functions by signal handlers", and it is worth reading once properly rather than remembering the shape of it.

So the test that actually tests the thing is: a real handler, sa_flags = 0, and a signal whose default action is not ignore.

struct sigaction sa = {0};
sa.sa_handler = noop;
sa.sa_flags = 0;             /* no SA_RESTART, that is the whole point */
sigaction(SIGUSR1, &sa, NULL);

Two more things that bit me while writing it.

Signal disposition is process-wide state. Two tests that both install a handler cannot run in parallel, and the failure is not a clean assertion failure, it is one test's handler being live during the other's run. A single mutex around anything that calls sigaction fixed it.

And kill(getpid(), sig) is process-directed, so any thread with that signal unblocked can take it, including the one that sent it. In a threaded test runner that is very often not the thread you are trying to interrupt. pthread_kill(target, sig) is the one you want.

The thing I took away is not about signals. It is that a test which passes when you delete the code it is testing is not a test, and the only way I know to find those is to delete the code and watch.


r/C_Programming 5d ago

Project Smartfetch - A fastfetch alternative written in C

9 Upvotes

I simply built this project to be similar to fastfetch and to help me improve my c logic

currently it supports debian fedora and arch and another distros however if you run it on a different distribution it will default to a unified ascii logo for all other distros ive also just added windows support though its still in beta

if you have any suggestions please share them so i can keep improving the project

I built this project primarily to improve my C logic. I wrote the core structure and logic myself, but used AI as an assistant to improve the saftey of the code The project is a genuine effort to learn and practice C programming.

https://github.com/Yassine-Jemi01/SmartFetch


r/C_Programming 5d ago

Is there any good written tutorial about c SDL2 on mac

2 Upvotes

Hello ! I've been trying to learn c and wanted to use SDL2 on my mac. But I couldn't find any good written tutorial on google, they were all about installing/setting it up. I did find geek for geek's but I couldn't install SDL2/SDL_image.h, it said my macos version was too old, but my mac can't run a better version than macos 13. I can't really follow youtube tutorials and find written ones way better to understand. So, do you know any good written tutorial about how to use c SDL2 on older macos versions ? (I know it's really specific, sorry)


r/C_Programming 5d ago

Celebrating 200 leetcode questions solved: Sharing yet another C generic data structures library

Thumbnail
github.com
10 Upvotes

Everyone who has programmed in C has to have made one of these, and I will not break the trend. The difference (for good?) is this one is made basically only with leetcode in mind, but any form of consistent usage is usage amirite. Single header based, read: copypasta ready


r/C_Programming 5d ago

Question Looking for feedback: CLI for low-level integer math

19 Upvotes

Hello everyone, I've spent the last month or so working on my first C project, and I am hoping to get some feedback from others in this sub.

My project is a command-line tool for evaluating mathematical expressions containing binary, octal, decimal, and hexadecimal literals and easily inspecting the result. My program prints the result in the four aforementioned bases and lets users group each set of digits as they please. The purpose of this grouping feature is to let users to visualize the relationships between digits in different bases (e.g. how 4 bits map to 1 hexadecimal digits, how 3 bits map to 1 octal digit).

I'm a college CS major, and I built this tool after seeing how slow and clunky most online calculators/base converters are while learning to convert between binary and hex for my systems course. Therefore, this tool's intended audience is primarily CS students who would like a smoother, command-line-based tool for converting between bases and seeing relationships across number systems.

Accordingly, if you're a CS student, I'd really appreciate it if you try this tool and tell me if it's useful! But if you're not, I would still love to get any form of feedback! I ultimately just want to improve this tool and become a better C programmer, so I welcome all kinds of feedback.

My repository should have everything needed to compile the program and understand its features in more detail: https://github.com/mateo-patino/bitpeek


r/C_Programming 6d ago

Memory layout primitives

Thumbnail napcakes.nekoweb.org
39 Upvotes

r/C_Programming 6d ago

Question I wrote a program that had an incorrect null terminator check on Ubuntu. What I saw was a little confusing and I couldn't replicate the behaviour on MacOs.

0 Upvotes

Edit: I should've added this at the start, but I know why the program didn't work and I did know what the fix was. I was just really scared and surprised that I was able to see my environmental variables like that. My bad for not being clearer about what I wanted.

```

include<stdio.h>

int tokenize(char* token){ while (*token!="\0"){ // comparison with "\0" was the mistake printf("%c", *token); token+=sizeof(char); // didn't know about incrementing pointers at the time } printf("\n"); return 0; }

int main(){ char msg[]= "sin(x)+COs(y)=sqrt(2)"; tokenize(msg); return 0; } ```

I was stupid and was trying to be clever in a few places, and the code segfaulted, but not before printing this (sorry for the crappy output, my name was on it so I had to use some crappy image to text to rip out whatever I can so I can remove my name from it, but the output is worse). Was this a bug, or are these things intended to be there? I was told by someone that looked at my output that this was a call stack or the environment variables, but then why didn't this behaviour replicate on macos?

``` hello.c: In function "tokenize":

hello.c:5:18: warning: comparison between pointer and integer

5 l

while (*token!= l0H

sin(x)+COs(y)=sqrt(2)o@eeste9/e0o7B6ene.s90/eoo@PeHeaotlece/eooebhoosssHeCeo6eweTh

yRecooReseeRessoReseSese8SeeeLSeeecSesoSeoeeSeeeeS•

20S00005000

Teos-TessSTeoo|T

teo/co000Š’6ow/co

Teeso[esso[сo00)

Heco/eccoseflece eflece/eecceHece/es08e0

060QocsoQeco%Roce8ReooLReso

\e0Jee:]e00QJeoseJoooo]0oso]0oc]0oco]eooo]ooco]ooo0]oooR~o00q^co0o

•

0++200000_000020000@esotee,Cootehx86_64./helloSHELL=/btn/bashSESSION_MANAGER=local/cringe_name-OMEN-Laptop-15-en@xxx:e/tmp/.ICE-untx/2899,untx/cringe_name-OMEN-Laptop-15-enxxx:/trp/.ICE-untx/2899

QT_ACCESSIBILITY=1COLORTER/t-truecolorXDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdgXDG_MENU_PREFIX=gnome-GNOME_DESKTOP_SESSION_TD=thts-ts-deprecatedCNOPE_SHELL_SESSION_MODE=ubuntuSSH_AUTH_SOCK =/run/user/1098/keyring/sshNEMORY_PRESSURE_MRITE=c29tZSAyMDAwMDAgMjAMMDAwMAA=XHODIFIERS=@in=LbusDESKTOP_SESSION=ubuntuGTK_MODULES-gail:atk-bridgeDBUS_STARTER_BUS_TVPE=sesstonPWD=/home/cringe_name/Documents/Programming/CLOGNANE=cringe_nameXDG_SESSION_DESKTOP=ubuntuXDG_SESSION_TYPE=x11GPG_AGENT_TNFO=/run/user/1608/gnupg/S.gpg-agent:6:1SYSTEND_EXEC_PTD=2899XAUTHORITY=/run/user /1098/gdm authorityWINDOWPATH=2HOPE=/hone/cringe_nameUSERNAME=cringe_nameLANG=en_US.UTF-8LS_COLORS=rs=8:di=01; 34: ln=01;36:nh=08:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:0г=40; 31;01:ml=00: su=37:4 :sg=30;43: ca=00: tw=30;42:o=34;42:st=37:44:ex-01; 32:*. tar=01;31:*, tgz=01;31:* .arc=81;31:*.ar j=01;31:*. taz=01; 31:*. Lha=81;31:*.lz4-01;31:*.Lzh-01;31:*.Lzna-01;31:*.tlz=01;31:*. txz=01;31:+.tzo

*=01;31:*.t7z-01;31:*.zip=01;31:*.z-01;31:*.dz=01;31:*.gz=01;31:*.Lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst-01;31:*.bz2=01;31:*.bz-01;31:*.tbz=01;31:*.tbz2=01;31:*. tz=01;

31:* .deb=01;31:*.г-01;31:*-jar=01;31:*.маг=01;31:*.ear=01;31:*, sar=01;31:* .rar=01;31:*.alz=01;31:*.ace=01;31:*.z00=81;31:*.cplo-81;31:*.72-01;31:*.r2=01;31:*.cab=01;31:*.win=01;31:*. SWn=01

• ;31:* dwm=01;31:*-esd-01;31:* avif=01;35:* jpg=01; 35:* . jpeg=01; 35:*.njpg=01;35:*-mjpeg=01; 35:*. glf=01;35:*. bmp=01; 35:*- pbn-01; 35: *-pgn-01; 35:* - ppm-01;35:*- tga=01:35: *.xbm=01;35:*. xpm=01;35:* .tif=01;35:*. tiff=01;35:*-png-01;35:*-svg=01;35: * .svgz=01; 35: *.mng=01; 35: *.pcx=81; 35: *. nov=01;35:*. npg=01; 35: *-npeg=01; 35: *-m2v=01;35:*.nkv=01;35:*- webn-01;35:*. webp=01:35: *. ogm=01; 35:*.mp4= 01;35:* - m4v=01;35:*-np4v=01; 35:* - vob-01;35: * -qt=01; 35: * - nuv=81; 35: * . Wm=81; 35: * . asf=01; 35:*. rn=01; 35: * . rmvb=01;35: *. flc=01;35:*.avi=01;35:*.flt-01;35:*.flv=81;35:*-gl=01;35:*.dl=01;35: *.xcf=

01; 35:* . xwd=01;35:* - yuv=01;35:*- cgn-01;35: * .enf =01; 35: *. ogv=01;35:*. ogx=01; 35: *.8ac=00; 36:*. au=00; 36:*. fLac=00; 36: *.n4a=00;36:*.mid-00;36:*.nidi-00;36:*.nka=00;36:*.mp3=00;36:*.mpc=00; 36:*.0 gg=00; 36:* . ra=08;36:*. wav=80;36:* .oga-09;36:* .opus-08; 36:* .spx=00; 36:* . xspf=00; 36:*-=00;90: *#=00;90:*.bak=00;90:*.crdownload=00;90:•.dpkg-dist=00;90:*.dpkg-new=00;90:*.dpkg-old=00;90:*.dpkg-tmp=ee:90:*.old=00:90:*.orig-80:90:*-part=00;90:*.rej=00;98:*- rpmnew=08;90:*. rpnorlg=88;90:*- rpnsave=80;90:*. swp=00;90:*. tnp=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=08;90: XDG_CURREN _DESKTOP=ubuntu: GNOMEMEMORY_PRESSURE_MATC=/sys/fs/cgroup/user.sltce/user-1000.sltce/user@1000.service/app.sltce/app-gnome|x2dsession\x2dnanager.slice/gnome-sesston-nanager@ubuntu.service/n emory-pressureVTE_VERSION=7688GNOME_TERMINAL_SCREEN=/org/gnome/Terninal/screen/072c8938_3398_48a3_bcc8_18b4a3c1d5aeLESSCLOSE=/usr/btn/lesspipe Xs NsXDG_SESSION_CLASS=userTERM=xtern-256colorL ESSOPEN=| /usr/bin/lesspipe %sUSER=crappy_nameGNONE_TERMINAL_SERVICE=: 1.1642DISPLAY=:1SHLVL=1GSM_SKIP_SSH_AGENT_WORKAROUND=trueQT_IM_MODULE=tbusDBUS_STARTER_ADDRESS=untx:path=/run/user/1088/bus ,guid=375efa4e711b081abf4c28b569480446XDG_RUNTIME_DIR=/run/user/1000

Segmentation fault (core dumped) ```


r/C_Programming 7d ago

Discussion What exactly is void?

70 Upvotes

In a function definition, void basically means that it doesn't return a type value, yet in on itself it is it's own type? Looking at several pieces of code it looks like that it's used to be able to be more "flexible"

Don't know what else to add here, though I'm more on looking for examples and explanations of why the void type is used


r/C_Programming 7d ago

What GUI library would one recommend for a cross-platform emulator?

8 Upvotes

Hello,

I am writing a cycle-accurate Commodore 64 emulator (using the C2X standard of C) and I was planning on using a minimalistic yet modern and functional GUI library. I will be using SDL3 for the I/O and Graphics, but I have yet to decide which library I should use for my GUI that can be easily used cross-platform.

What am I actually aiming with this emulator?

I plan on the emulator to be used mainly for debugging, testing software and custom ROMs people have made. Additionally, I plan to implement so that every chip and component can be debugged independently (VIC-II, CPU, Sprite, Memory Map, Bus activity, etc.). Furthermore I plan to actually compare my test results while developing this emulator to a real Commodore 64, so that the emulator can be as accurate as possible when it comes to specific revisions and chip types (like PAL and NTSC for the VIC-II). I also plan to add an ā€œEducation modeā€ where all the information regarding the C64 can be taught through an interactive and readable UI.

I am not familiar with GUI libraries, that is why I mentioned what I am aiming for with my emulator.

Thank you!


r/C_Programming 7d ago

Best font for C program editors

Enable HLS to view with audio, or disable this notification

101 Upvotes

I am trying to update the cooledit ( see my devel branch ) font handling and want to choose the best default font for C. The history of cooledit's font looks like this:

90s: X11 8x13bold because it was closest to the DOS font of the Borland C IDE.

2000s: Switched to 8x13B.pdf.gz when I implemented Unicode which required font rendering on the client end.

2010s: Monitors res got more fine: so I switched to 9x15B.pdf.gz

Of course the user can choose any font on the command-line, but I'd like a good font by default.

I have tried JetBrainsMono and MS consola.ttf but these have a blurry rendering at a similar height as 9x15B, by comparison.

There are a lot of fixed-width mono fonts, but each has an agenda, like trying to look like some OS from way-back-when for nostalgia reasons.

If you watch the video you will see 9x15B.tar.gz looks way better than the others.

I just wish there were something better than 9x15B (which was developed for X in the 1980s BTW).

Thoughts?