Show newer

Write unit tests before code.
Write documentation before code.
Use autodocumenting code like Doxygen.

use godbolt.org/ to test code on multiple compilers without having to have them installed locally

If you are programming in C consider adding c++ guards around your file scope variables and prototypes, and use the c++ compiler. You will find additional errors and warnings the c compilers alone won't find. Also, compile with both gcc and clang and use as many others as well as static analysis tools as you can. cppcheck can be your friend. valgrind can be your best friend.

when developing use -Wall and
-Wextra with gcc and -Weverything with clang... as a minimum. Consider pedantic also.

do not use dynamically allocated arrays on the stack. Do so on the heap only

if you allocate memory, you need to free it. strdup() allocates memory.... damnit!

String functions such as *printf() str*cmp() and others are meant to take string pointers. Under no circumstances should you use a function call, that returns NULL to indicate an error (like getenv()), as a parameter.

Unless you are working with an 8 bit compiler 0, '\0', and NULL are not synonyms.

When a C compiler gives you a warning, there is no reason to ignore it. If your code base is full of warnings how can you ever tell which poorly written piece of code is causing your current problem?

IBM XLC C compiler on AIX will treat a NULL as though it were an empty string "". There is a special circle of hell reserved for people that code counting on that behavior.

@hund@linuxrocks.online @kde@mastodon.technology probably more closely related to IBM and SAA / CUA compliance, which Windows tries to comply with as well

@hund@linuxrocks.online @kde@mastodon.technology I don't believe Windows had anything to do with it. I believe it had more to do with having consistent interfaces across the desktop. You can probably find the whole usenet conversation that stated the project if you look deep enough.

@CyclopsCaveman If I ever meet you I will have hard enough time remembering your name. When we meet again, I will have forgotten your name, and absent a name tag I will ask it again. As for your pronouns, I will mostly be using "you" as I will rarely have reason to speak of you in 3rd person. And if I do speak of you in 3rd person, it would be by your name. I just don't find pgp's useful.

@kiilas wow, that is a very generous offer. I have a feeling I may have to take you up on it.

@nergal @BradleySmall @malin not of you download your contacts and such. You can easily enough come back on social.linux.pizza or mastodon.social or any number of other mastodon or those other two that also federated with mastodon servers

Show older
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.