-
Any good cheat sheets about C?
Any good cheat sheets about C?
I have found only this one https://cheatography.com/ashlyn-black/cheat-sheets/c-reference/
Maybe you know any else?
-
Flappy Bird for Android, only C, under 100KB
github.com GitHub - VadimBoev/FlappyBirdContribute to VadimBoev/FlappyBird development by creating an account on GitHub.
cross-posted from: https://discuss.tchncs.de/post/22432836
-
ACBS - Another C Build System
I created a little side project over the past few days, a new build system for C and C++: https://github.com/blueOkiris/acbs/
I've seen a lot of discourse over C build tools. None of them really seem solid except for (some) Makefiles (some Makefiles are atrocious; you just can't rely on people these days). Bazel, cmake - they're just not straight forward like a clean Makefile is, basically black magic, but setting up a Makefile from scratch is a skill. Many copy the same one over each time. Wouldn't it be nice if that Makefile didn't even need to be copied over?
Building C should be straight forward. Grab the C files and headers I want, set some flags, include some libraries, build, link. Instead project build systems are way way way overcomplicated! Like have you ever tried building any of Google's C projects? Nearly impossible to figure out and integrate with projects.
So I've designed a simplistic build system for C (also C++) that is basically set up to work like a normal Makefile with gcc but where you don't have to set it up each time. The only thing you are required to provide is the name of the binary (although you can override defaults for your project, and yes, not just binaries are possible but libs as well). It also includes things like delta building without needing to configure.
Now there is one thing I haven't added yet - parallel building. It should be as simple as adding separate threads when building files (right now it's a for loop). I know that's something a lot of people will care about, but it's not there yet. It's also really intended to only work with Linux rn, but it could probably pretty easily be adjusted to work with Windows.
Lay your project out like the minimal example, adjust the project layout, and get building! The project itself is actually bootstrapped and built using whatever the latest release is, so it's its own example haha.
It's dead simple and obvious to the point I would claim that if your project can't work with this, your project is wrong and grossly over-complicated in its design, and you should rework the build system. C is simple, and so should the build system you use with it!
So yeah. Check it out when y'all get a chance
-
Getting back into C programming for CP/M
> This article is about developing in C for CP/M, using a 40-year-old C compiler, and how this differs from modern C development. The compiler I'm using is the 1982 release of Manx Software Systems' "Aztec C". The compiler is freely, and legally, available from the Aztec Museum. A lot of CP/M software falls into the broad category of "abandonware" -- software that is notionally still protected by intellectual propery law, but whose owners have no interest in it, or cannot even be identified.
-
Writing a game the hard way - from scratch using C.
YouTube Video
Click to view this content.
-
Writing a C Compiler | Build a Real Programming Language from Scratch | Nora Sandler | July 2024 | No Starch Press | 792 pages | ISBN-13: 9781718500426
nostarch.com Writing a C CompilerA fun, hands-on guide to writing your own compiler for a real-world programming language.
Book Description
Writing a C Compiler will take you step by step through the process of building your own compiler for a significant subset of C—no prior experience with compiler construction or assembly code needed. Once you’ve built a working compiler for the simplest C program, you’ll add new features chapter by chapter. The algorithms in the book are all in pseudocode, so you can implement your compiler in whatever language you like. Along the way, you’ll explore key concepts like:
- Lexing and parsing: Learn how to write a lexer and recursive descent parser that transform C code into an abstract syntax tree.
- Program analysis: Discover how to analyze a program to understand its behavior and detect errors.
- Code generation: Learn how to translate C language constructs like arithmetic operations, function calls, and control-flow statements into x64 assembly code.
- Optimization techniques: Improve performance with methods like constant folding, dead store elimination, and register allocation.
Compilers aren’t terrifying beasts—and with help from this hands-on, accessible guide, you might even turn them into your friends for life.
Author Bio
Nora Sandler is a software engineer based in Seattle. She holds a BS in computer science from the University of Chicago, where she researched the implementation of parallel programming languages. More recently, she’s worked on domain-specific languages at an endpoint security company. You can find her blog on pranks, compilers, and other computer science topics at https://norasandler.com.
-
fatal error: dbus/dbus-arch-deps.h: No such file or directory
cross-posted from: https://lemmy.ml/post/17545833
> im new to system programming, idk if thats the issuse. but according gcc, it can not find
dbus/dbus-arch-deps.h
and thats all i know. any idea about this issue? > >> program > [I] tomri@artix ~ [1]> cat main.c > #include <dbus-1.0/dbus/dbus.h> > > int main(void) { return 0; } >
>> # error > [I] tomri@artix ~> gcc main.c > In file included from main.c:1: > /usr/include/dbus-1.0/dbus/dbus.h:29:10: fatal error: dbus/dbus-arch-deps.h: No such file or directory > 29 | #include <dbus/dbus-arch-deps.h> > | ^~~~~~~~~~~~~~~~~~~~~~~ > compilation terminated. >
>> [I] tomri@artix ~> ls -la /usr/include/dbus-1.0/dbus/ > total 216 > drwxr-xr-x 2 root root 4096 Jul 2 20:26 ./ > drwxr-xr-x 3 root root 4096 Jun 15 21:36 ../ > -rw-r--r-- 1 root root 2809 Jan 14 06:17 dbus-address.h > -rw-r--r-- 1 root root 3470 Jan 14 06:17 dbus-bus.h > -rw-r--r-- 1 root root 27018 Jan 14 06:17 dbus-connection.h > -rw-r--r-- 1 root root 2909 Jan 14 06:17 dbus-errors.h > -rw-r--r-- 1 root root 22076 Jun 8 2023 dbus-glib-bindings.h > -rw-r--r-- 1 root root 2575 Jun 8 2023 dbus-glib-lowlevel.h > -rw-r--r-- 1 root root 14766 Jun 8 2023 dbus-glib.h > -rw-r--r-- 1 root root 8969 Jun 8 2023 dbus-gtype-specialized.h > -rw-r--r-- 1 root root 1464 Jun 8 2023 dbus-gvalue-parse-variant.h > -rw-r--r-- 1 root root 7246 Jan 14 06:17 dbus-macros.h > -rw-r--r-- 1 root root 1961 Jan 14 06:17 dbus-memory.h > -rw-r--r-- 1 root root 15259 Jan 14 06:17 dbus-message.h > -rw-r--r-- 1 root root 1810 Jan 14 06:17 dbus-misc.h > -rw-r--r-- 1 root root 3809 Jan 14 06:17 dbus-pending-call.h > -rw-r--r-- 1 root root 23956 Jan 14 06:17 dbus-protocol.h > -rw-r--r-- 1 root root 5412 Jan 14 06:17 dbus-server.h > -rw-r--r-- 1 root root 5392 Jan 14 06:17 dbus-shared.h > -rw-r--r-- 1 root root 3047 Jan 14 06:17 dbus-signature.h > -rw-r--r-- 1 root root 2359 Jan 14 06:17 dbus-syntax.h > -rw-r--r-- 1 root root 8505 Jan 14 06:17 dbus-threads.h > -rw-r--r-- 1 root root 4143 Jan 14 06:17 dbus-types.h > -rw-r--r-- 1 root root 3961 Jan 14 06:17 dbus.h > [I] tomri@artix ~> >
>> # my system > [I] tomri@artix ~> uname --all > Linux artix 6.9.7-artix1-1 #1 SMP PREEMPT_DYNAMIC Fri, 28 Jun 2024 18:11:28 +0000 x86_64 GNU/Linux >
-
The C Standard charter (2024)
www.open-std.org The C Standard charterGuiding document with overview of the C committee's mission and expectations
-
A History of C Compilers - Part 1: Performance, Portability and Freedom
thechipletter.substack.com Freedom and PortabilityLet's talk compilers with part one of a whistle stop tour of their history
-
One year of C (2018)
floooh.github.io One year of CIt’s now nearly a year that I started writing non-trivial amounts of C codeagain (the first sokol_gfx.h commit was on the 14-Jul-2017), so I guess it’stime f...
-
Blackjack game as a learning experience - Request for suggestions, ways to make it better, advice etc...
github.com GitHub - promitheas17j/blackjack: CLI Blackjack (21) written in C as practiceCLI Blackjack (21) written in C as practice. Contribute to promitheas17j/blackjack development by creating an account on GitHub.
Hello everyone :)
I recently wrote a small blackjack game where the challenge I set myself (and the learning goal) was to use pointers to do stuff. So for example instead of having all my functions written in such a way as to avoid using pointers I would use them wherever possible.
It works in its current form and seems to do so quite well, but I would like to learn even more from this project. So here I am asking for your experience. Please give me any suggestions, advice, ways to make it more efficient in terms of memory used, ways to make it more efficient in terms of speed (I know memory and speed might not be so important for a small project like this but my goal is to practice and learn the underlying concepts), criticisms, best practices, or anything you that comes to mind when you look at the code.
As an example of what I mean, I would like to make it so that the arrays which hold the player and dealer hands are not of fixed size on declaration, but grow and shrink dynamically as cards are added and removed from them (practice memory allocation/deallocation).
I hope I provided enough info about what I am looking for in a clear manner, but if not please do ask for clarification/additional info.
Thanks in advance!
- developers.redhat.com Improvements to static analysis in the GCC 14 compiler | Red Hat Developer
Learn about static analysis improvements coming in GCC 14 with -fanalyzer, which helps identify issues in C code at compile-time, rather than at runtime.
- opensource.com How to write a good C main function
Learn how to structure a C file and write a C main function that handles command line arguments like a champ.
-
C can be memory-safe (2023)
blog.erratasec.com C can be memory-safeThe idea of memory-safe languages is in the news lately. C/C++ is famous for being the world's system language (that runs most things) but ...
-
Modern C, Third Edition (covers the C23 standard)
Almost 50 years ago, the C language defined modern computer programming. This book shows you why C is still as powerful and popular as ever, with an inside look at the new C23 standard.
For programs that need to be small, fast, and unfailingly reliable, C is still the gold standard. Whether you’re writing embedded code, low-level system routines, or high-performance applications, C is up to the challenge. This unique book by Jens Gustedt, a member of the ISO C standards committee, gets you up to speed with C23.
In Modern C, Third Edition you’ll:
- Learn C basics, core features, and advanced concepts
- Leverage major C23 improvements for security, reliability, and performance
- Write portable code that runs anywhere
- Build multi-threaded applications with atomics and synchronization
- Create robust and resilient software with error handling
- Use type-generic programming for reusable code
C powers more software than any other language — from embedded devices to distributed systems. In Modern C, Third Edition you’ll learn to harness C’s full potential using the latest tools and techniques. After a quick review of the fundamentals perfect for beginners or coders who haven’t used C in a while, this book guides you to mastery of C23, the latest ISO standard.