Skip to content

Commit 9013d75

Browse files
committed
Upcase readmes.
1 parent 397201a commit 9013d75

33 files changed

Lines changed: 1332 additions & 42 deletions

File tree

‎README.md‎

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,5 @@
11
Simple C and C++ programs, cheats and mini projects.
22

3-
Larger projects may be in separate dirs.
4-
5-
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.
6-
7-
Non-portable features shall be clearly separated from portable ones in either:
8-
9-
- ifdef blocks
10-
- separate files
11-
- separate directories
12-
- separate repositories
13-
14-
# Bestof
15-
163
The most useful sections are currently:
174

185
- [c/c.c](c/c.c): C cheatsheet.
@@ -24,11 +11,37 @@ Other reasonably useful cheats can be found under:
2411
- [opengl/](opengl/)
2512
- [kde/](kde/)
2613

27-
# Cheatsheets
14+
# Install on Linux
15+
16+
Most systems already have GCC installed, however some of this relies on the recent GCC 4.7 to be able to try out bleeding edge c11.
17+
18+
This is not recommended for production.
19+
20+
On Ubuntu 12.04, install GCC 4.8 with:
21+
22+
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
23+
sudo aptitude install -y update
24+
sudo aptitude install gcc-4.8
25+
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50
26+
27+
# About
28+
29+
Currently uses Linux tools, but Windows ports are welcome.
30+
31+
Larger projects may be in separate dirs.
32+
33+
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.
34+
35+
Non-portable features shall be clearly separated from portable ones in either:
36+
37+
- ifdef blocks
38+
- separate files
39+
- separate directories
40+
- separate repositories
2841

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

31-
For exemple, a C addition operator `+` test should be done as:
44+
For example, a C addition operator `+` test should be done as:
3245

3346
assert(1 + 1 == 2);
3447

@@ -49,10 +62,6 @@ Features that:
4962

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

52-
Cheat source comments are writen in markdown *indented by headers* and commented out.
65+
Cheat source comments are written in markdown *indented by headers* and commented out.
5366

5467
Every important keyword that one might search for in the feature has a hash before it, e.g. `#function`, `#include`, `#printf`, etc.
55-
56-
# Contributing
57-
58-
If you find any factual error, or want to include new information, you are more than welcome to send a PR!

‎c/README.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Cheatsheets, templates and info on C and C++.
2+
3+
Attempts to understand every minute behavior and performance characteristic of the language and the stdlib.
4+
5+
Whenever possible, asserts are used to make sure things are correct.

‎c/c.c‎

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6491,39 +6491,51 @@ int main(int argc, char **argv)
64916491
//#control minimum number chars to output
64926492
{
64936493
/*
6494-
#pad with spaces
6494+
Pad with spaces, right align.
64956495
6496-
Useful to output nicely formatted tables.
6496+
Useful to output nicely formatted tables.
64976497
6498-
Ugly:
6498+
Ugly:
64996499
6500-
12345 1
6501-
1 1
6500+
12345 1
6501+
1 1
65026502
6503-
Beautiful:
6503+
Beautiful:
65046504
65056505
12345 1
65066506
1 1
6507-
65086507
*/
65096508
{
65106509
sprintf(s, "%6.2f", 1.0f);
65116510
assert(strcmp(s, " 1.00") == 0);
65126511
}
65136512

65146513
/*
6515-
#pad with zeros
6516-
6517-
useful for naming files:
6514+
Pad with zeros
65186515
6519-
"10" comes after "09" ('1' > '0')
6516+
Useful for naming files: with `0`
65206517
6521-
"10" comes before "9" ('1' < '0')!
6518+
- "10" comes after "09" ('1' > '0')
6519+
- "10" comes before "9" ('1' < '0')!
65226520
*/
65236521
{
65246522
sprintf(s, "%06.2f", 1.0f);
65256523
assert(strcmp(s, "001.00") == 0);
65266524
}
6525+
6526+
/*
6527+
Left align with `-`
6528+
*/
6529+
{
6530+
sprintf(s, "%-6s", "abc");
6531+
assert(strcmp(s, "abc ") == 0);
6532+
6533+
// Does not work with zeros:
6534+
6535+
sprintf(s, "%-06s", "abc");
6536+
/*printf("%s\n", s);*/
6537+
/*assert(strcmp(s, "abc ") == 0);*/
6538+
}
65276539
}
65286540

65296541
//#scientific
File renamed without changes.
File renamed without changes.
File renamed without changes.

‎c/readme.md‎

Lines changed: 0 additions & 10 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)