Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Posts by Lundin
Whenever registering to diverse sites on the net, you are often forced to enter a so called "strong password", which would ideally contain both upper case letters, lower case letters, digits, and s...
Search engine optimization? I thought this goes without saying, but apparently we aren't doing too well there for some reason. The other day I was having a discussion with someone at SO regarding...
These examples have undefined behavior and unspecified behavior all at once! Operator precedence has nothing to do with the order of execution, see What is the difference between operator precedenc...
The C language has gone through many iterations and the latest one not yet released is informally called "C23", supposedly because they hoped to release it in 2023. The latest draft version N3096 i...
SIGSEGV is defined in the C header signal.h. To generate the signal, it should be sufficient to just do raise(SIGSEGV);. As far as I know, this is well-defined behavior.
C23 will be a major revision, certainly the biggest one since C99. It contains lots of changes and new features, both big and small. The linked draft in the question contains a complete list of cha...
Should we cast the result of malloc? The cast to the intended type is not necessary in C, since during assignment, the void* returned by malloc can be implicitly converted to any other object poin...
When reading posts at programming sites such as this one, I frequently encounter people saying things like: "There is no pass-by-reference in C, everything is passed by value." People claiming su...
I once wrote this post here: Why can't we mix increment operators like i++ with other operators? When using Codidact search looking for that post, I tried to type i++ in the search but it didn't l...
The sole purpose of the do { } while(0) is to write macros that accommodates to all manner of diverse coding styles. It is quite common not to use braces after if statements, so this is a common co...
Summary (TL;DR) Using strcpy directly on non-sanitized user input is bad, otherwise it's fine. strncpy is a dangerous function that should be avoided. Its presence in your source is a muc...
The warnings just say that you can't pass a string literal with type char[] to a function taking a struct Book* parameter. The function should be declared as: void init_Book_types (const char* tit...
First of all, I realize that this is mostly a library you've implemented while learning programming, for the sake of learning, which is great. So I would rather not put a "wet blanket" over your at...
Does Inteheritance actually meant return and Polymorphism meant to print out values? This doesn't make the slightest sense... Probably you should forget all you've heard - don't "watch tutoria...
This is meant as a FAQ Q&A regarding variable-length arrays (VLA). The two bugs described below are surprisingly common. I'm trying to use the variable-length arrays feature of C99 (and newe...
It is true that MISRA-C has a heavy focus on embedded system, though it has become somewhat more generic over time. The MISRA guidelines have been changed and improved several times over the years ...
When discussing best or safest C programming practices with various C gurus on the Internet, the "MISRA-C guidelines for the use of C language in critical systems" often pops up as a source. This ...
It would seem that the C standard library is a collection of diverse functions that pretty much just ended up in the standard by tradition or "accident", rather than through some careful plan or ra...
For what it's worth, I have some 20 years of experience designing embedded C systems, with large and small code bases both. Code design is some of the hardest things to do, since books about object...
Regarding undefined behavior/uninitialized variables of automatic storage duration First of all there's some misconceptions here. if (x == 0) is UB only because x was declared as a local variable...
Google Sheets isn't a company name, it's a product name. A tag called google-sheets is perfectly fine. Google doesn't market this product as "Sheets", they market it as "Google Sheets". What is not...
When doing something simple such as this int a=1; int b=2; int c=3; printf("%d\n", a + b * c); then I was told that operator precedence guarantees that the code is equivalent to a + (b * c)...
The size of the "primitive data types" int, float etc is not defined by the standard. In practice, int is either 16 or 32 bits on all known systems. Because of the unspecified size leading to poor...
I agree and I think it should be a separate category, with separate posting rules. There are several examples of how the rules for each category would likely be fundamentally different: Main Q&...
Yes, it is generally good practice to always cast the return value of functions to (void) if not used. This is self-documenting code showing that you aren't using the return value on purpose and di...