We are still actively working on the spam issue.

Difference between revisions of "C Help and Discussion"

From InstallGentoo Wiki
Jump to: navigation, search
m (Adds dpt roll from >>92426111 (checked))
(Some additions and repairs.)
Line 23: Line 23:
 
== Recommended Build Options ==
 
== Recommended Build Options ==
 
=== Warnings ===
 
=== Warnings ===
For GCC, it is generally recomended to use `-Werror -Wall -Wextra -Wpedantic`; and for Clang it's recommended to use `-Werror -Weverything`.
+
For GCC, it is generally recommended to use `-Werror -Wall -Wextra -Wpedantic`; and for Clang it's recommended to use `-Werror -Weverything`.
 
=== Release options ===
 
=== Release options ===
 
`-O2 -DNDEBUG` Provides good optimizations, and `-Os` is generally discouraged due to some bad trade offs that may occur reducing optimization greatly.
 
`-O2 -DNDEBUG` Provides good optimizations, and `-Os` is generally discouraged due to some bad trade offs that may occur reducing optimization greatly.
 
=== Debug options ===
 
=== Debug options ===
`-Og -g`, use `-ggdb` if you intend to use that tool.
+
`-Og -g -fsanitize=address,undefined`, use `-ggdb` instead of `-g` if you intend to use GNU Debugger.
 +
 
 +
Tools like [https://valgrind.org/ Valgrind], [https://splint.org/ Splint] will help you debug and improve your code.
  
 
== C Misconceptions ==
 
== C Misconceptions ==
Line 51: Line 53:
  
 
- [https://files.catbox.moe/7zgskj.pdf KING PDF]
 
- [https://files.catbox.moe/7zgskj.pdf KING PDF]
 +
 +
- [https://files.catbox.moe/vj4jpp.pdf RMS GUIDE PDF]
  
 
=== Notable Projects Summited ===
 
=== Notable Projects Summited ===

Revision as of 21:51, 29 March 2023

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