We are still actively working on the spam issue.

C Help and Discussion

From InstallGentoo Wiki
Revision as of 21:51, 29 March 2023 by Emil (talk | contribs) (Some additions and repairs.)
Jump to: navigation, search
The C Programming Logo
A set of challenges

C Help and Discussion is an ongoing general. In it people discuss C/C++ programming, projects that they and others are working on. Show what your working on, and go mess around someones else's code.

Tools

Building and Build systems

Makefiles

"A Makefile a day keeps the doctor away." - me

Makefiles provide a very useful basis and if you fully grasp them, you can do most anything with enough investment. Though in most cases it's better to use Makefiles for small and simple projects.

Autobuild

A hellish extension of make. Stub.

CMake

CMake is a multi-platform build system that is the defacto successor to Autobuild. It's generally considered to have bad syntax, but can cover most needs with enough effort.

Meson

CMake with better syntax.

Recommended Build Options

Warnings

For GCC, it is generally recommended to use `-Werror -Wall -Wextra -Wpedantic`; and for Clang it's recommended to use `-Werror -Weverything`.

Release options

`-O2 -DNDEBUG` Provides good optimizations, and `-Os` is generally discouraged due to some bad trade offs that may occur reducing optimization greatly.

Debug options

`-Og -g -fsanitize=address,undefined`, use `-ggdb` instead of `-g` if you intend to use GNU Debugger.

Tools like Valgrind, Splint will help you debug and improve your code.

C Misconceptions

C is a small language!

C is often called a small language but this is simply not true. Its small RELATIVE to other languages. The set of information that is C is quite large on its own and takes a long time to master completely ("Master" could be defined as the ability to write a working standards-compliant compiler).

C has no package manager!

C has many, many package managers, one for every GNU/Linux Distribution.

Useful Links

Getting started

- Hello World!

- C FAQ

Challenge

- DPT ROLL

Books

- K&R PDF

- KING PDF

- RMS GUIDE PDF

Notable Projects Summited

- Dotris

- TeaChess

- Chad