Skip to content

About

MOVING TO: https://github.com/cirosantilli/linux-kernel-module-cheat#userland-content SEE README. C, C++, POSIX and Linux system programming minimal examples. Asserts used wherever possible. Hello worlds for cool third party libraries and build systems. Cheatsheets, tutorials and mini-projects.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

C and C++ information, cheatsheets and mini-projects.

Based on Linux tools, but portable code is clearly separated from non-portable. Thoroughly tested on Ubuntu 12.04. Ports and reproduction reports on other systems are welcome.

Compile and run

To compile and run each directory on Ubuntu 12.04 do:

make install-ubuntu
make run

You must run make install-ubuntu on the top-level before compiling any subdirectories.

When there are multiple files compiled, e.g.:

c.c -> c
cpp.cpp -> cpp

run a given file by specifying the basename without extension:

make run RUN=c
make run RUN=cpp

Doing just make run in those cases will run the default file.

Most useful files

  • c.c: C cheatsheet.
  • cpp.cpp: C++ cheatsheet.
  • Makefile.*: Makefiles that take care of a ton of possibilities.
  • opengl/
  • kde/

About

Larger projects may be in separate dirs.

There may be other compiled languages here for which we don't have much material for a separate dir, specially when we interface that language with C. Ex: Fortran.

Non-portable features shall be clearly separated from portable ones in either:

  • ifdef blocks
  • separate files
  • separate directories
  • separate repositories

Everything that can be checked in an assertion will be checked, and will not get printed.

For example, a C addition operator + test should be done as:

assert(1 + 1 == 2);

and never:

printf("%d\n", 1 + 1);

so that all can be verified automatically.

Features which yield unpredictable outputs can print results to stdout. For example, time(NULL)

printf("%d\n", 1 + 1);

Features that:

  • require user input such as C scanf
  • make programs wait for perceptible amounts of time

shall be put inside a block analogous to a if (0){ ... } to be turned on only when users want to test those specific features.

Cheat source comments are written in markdown indented by headers and commented out.

Every important keyword that one might search for in the feature has a hash before it, e.g. #function, #include, #printf, etc.

About

MOVING TO: https://github.com/cirosantilli/linux-kernel-module-cheat#userland-content SEE README. C, C++, POSIX and Linux system programming minimal examples. Asserts used wherever possible. Hello worlds for cool third party libraries and build systems. Cheatsheets, tutorials and mini-projects.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages