This commit is contained in:
Miloslav Ciz 2025-04-14 21:57:02 +02:00
parent 5604db85d2
commit d8f1711fa8
33 changed files with 2096 additions and 2036 deletions

View file

@ -1,10 +1,10 @@
# C Pitfalls
[C](c.md) is a powerful language that offers almost absolute control and maximum performance which necessarily comes with responsibility and danger of shooting oneself in the foot. Without knowledge of the pitfalls you may well find yourself fallen into one of them.
[C](c.md) is a powerful language offering almost absolute control and maximum performance which necessarily comes with a "responsibility" and the danger of proverbially shooting oneself in the foot. Without knowledge of the pitfalls you may well find yourself in one.
This article will be focused on C specific/typical pitfalls, but of course C also comes with general [programming](programming.md) pitfalls, such as those related to [floating point](float.md), [concurrency](concurrency.md), bugs such as [off by one](off_by_one.md) and so on -- indeed, be aware of these ones too.
This article will be focused on C specific/typical pitfalls, but of course C also comes with general [programming](programming.md) pitfalls, such as those related to [floating point](float.md), [concurrency](concurrency.md), [bugs](bug.md) such as [off by one](off_by_one.md) and so on -- indeed, be aware of these too.
Unless specified otherwise, this article supposes the C99 standard of the C language.
Unless specified otherwise, this article assumes the C99 standard of the C language.
**Generally**: be sure to check your programs with tools such as [valgrind](valgrind.md), [splint](splint.md), [cppcheck](cppcheck.md), UBSan or ASan, and turn on compiler auto checks (`-Wall`, `-Wextra`, `-pedantic`, ...), it's quick, simple and reveals many bugs! Also have the specification at hand, sometimes it's literally easier, safer and faster to look something up in the primary source rather than looking up opinions of the Internet people.