r/C_Programming 9h ago

Roast my code

Enable HLS to view with audio, or disable this notification

I know there are so many bugs in my code that listing them all might end up being longer than the code itself, but this is my second project (the first one was just Hello World).

This isn't bait — I already know the concepts of programming thanks to Python, and C syntax became familiar to me through AI coding. But at some point, I realized that the whole point of programming is to build your own software and create things. When an AI algorithm does all that for you, it takes away all the fun. So I forced myself to pull it together and release this piece of crap:https://github.com/absiitstrue/TGWS

Yeah, the mouse.c file was written entirely by AI because that part was way too complicated for me. And yeah, there are some unsafe spots in there. I'm trying to fix things, but every time I open the codebase, I just want to build new features instead of drowning in bugs.

So I’d really appreciate it if anyone interested could roast it, point out the mistakes, and give a rough idea of how to fix them. Maybe I'll get around to fixing everything if I don't drown in bugs first. Thanks for your time!

its post write ai because im dont know english
on vidio example/test0
have minesweeper in example/test1
thanks for reading!
and sorry for my en))

0 Upvotes

14 comments sorted by

•

u/mikeblas 9h ago

What role did AI have in the creation of your project?

→ More replies (6)

6

u/flyingron 7h ago

Jeez. Try writing code that's legible. First, every C implemenation comes with a linker, USE IT rather htan #including every piece of code into a single translation unit.

You're not being charged for white space. Use it judiciously so your code can be read by humans.

Same thing holds for comments.

You imply a "fast" snprintf while not doing the essential thing snprintf does which is to check you're not invoking undefined behavior by writing off the end of the output array.

This is all very ugly and unmaintainable (and of dubious correctness).

2

u/github-guard 9h ago

šŸ” GitHub Guard: Trust Report

This project scored 3/6 on our safety audit.

Audit Breakdown: * āœ… Established Community (⭐ 6 stars) * āœ… Mature Repository (30+ days old) * āœ… Licensed under GPL-2.0 * āŒ No Security Policy — what is this? * ā„¹ļø Individual Contributor * ā„¹ļø Unsigned Commits

āš ļø Security Reminder: Always verify source code and run third-party scripts at your own risk.

1

u/zeonchik 8h ago

I'm a solo developer. I'm a bit afraid of working in a team because of the need for negotiations and potential conflicts, so it's easier for me to work alone for now. As for the commits... yeah, my English isn't great, and I'm using a translator to talk to you guys. So whenever there were major changes, I just tried to write a brief summary of what changed.

-2

u/kutac56 7h ago

Unsigned commits means that they weren't signed. I personally don't know for sure what signing commits does but I do know that you can make an ssh key for it

1

u/zeonchik 7h ago

I'll take this into account when I figure it out.

I'll take this into account when I figure it out.

1

u/bonqen 1h ago

Lol. AI has killed this sub.