Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »

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‭

167 posts
71%
+3 −0
Q&A What is the meaning of "short circuit" operators?

It's an unfortunate analogy. Apart from being confusing, it does indeed assume some basic electronics knowledge. In electronics a short circuit (or the common jargon "a short") does not necessarily...

posted 1y ago by Lundin‭  ·  edited 1y ago by Lundin‭

Answer
71%
+3 −0
Q&A Casting a non-`void` pointer to `uintptr_t`

If reading the standard strictly by the letter then you are correct. And therefore both CERT and MISRA are picky with these kind of conversions because they strive to cover all poorly-defined behav...

posted 28d ago by Lundin‭

Answer
71%
+3 −0
Code Reviews A simple implementation of a mutable String in C

Design/API Consider hiding all details of the String internals to the caller by implementing opaque type - How to do private encapsulation in C? (As it happens, that post contains a example take...

posted 2mo ago by Lundin‭

Answer
71%
+3 −0
Q&A 2D-array pointer as a struct member

Given that you don't need the flexibility provided by a char** but rather need efficiency, plus a fairly large amount of items, it does sound like you need a true 2D array allocated on the heap. T...

posted 3mo ago by Lundin‭  ·  edited 3mo ago by Lundin‭

Answer
71%
+3 −0
Q&A How do you implement polymorphism in C?

First of all please note that polymorphism in C is clunky. It won't be pretty. We don't have this pointers, we don't have RAII, we don't have automatic constructors/destructors. Just accept that it...

posted 6mo ago by Lundin‭

Answer
71%
+3 −0
Q&A Which platforms return a non-null pointer on malloc(0)

It is trivial enough to test: #include <stdlib.h> #include <stdio.h> #include <errno.h> #define KNOWN_GARBAGE ((int*)~0u) int main (void) { int* ptr = KNOWN_GARBAGE; ...

posted 6mo ago by Lundin‭  ·  edited 6mo ago by Andreas demands justice for humanity‭

Answer
71%
+3 −0
Code Reviews New elementsof() operator

I don't really see what good elementsof would do since sizeof(arr)/sizeof(*arr) is pretty idiomatic C and problem-free given that you know what you are doing, as is the case with most C code. IMO ...

posted 8mo ago by Lundin‭  ·  edited 8mo ago by Lundin‭

Answer
71%
+3 −0
Q&A Testing an opaque type's internals

"Black box testing" makes sense when dealing with opaque types so that's the first thing you should be doing and probably the most meaningful test too, so that's where you should put most of yo...

posted 11mo ago by Lundin‭

Answer
71%
+3 −0
Meta Is software system design on topic here?

Software design in itself has always been on-topic, as per https://software.codidact.com/help/on-topic. As for system design for a given purpose, I think it is fine within reason. Contrary to popu...

posted 1y ago by Lundin‭

Answer
71%
+3 −0
Code Reviews Trie Implementation, Graph Visualization and Auto-Completion in C

General/program design: I would have expected a public header file with the API for the whole thing, rather than having some main() test case calling static functions from the same file. Sure,...

posted 1y ago by Lundin‭

Answer
71%
+3 −0
Meta What categories could we benefit from having?

Categories should be used when the posting rules for certain types of question differ. For example a debugging question posted below Q&A should have a minimal, relevant example. Whereas a code ...

posted 1y ago by Lundin‭

Answer
71%
+3 −0
Q&A Strict aliasing rules and function boundaries

Assuming that there are no alignment problems between the two pointer types (impl-defined), the code is otherwise well-defined. As per the quoted 6.3.2.3 C allows pretty much any form of wild and c...

posted 2y ago by Lundin‭

Answer
71%
+3 −0
Meta Asking and answering FAQ style questions

Yes it is fine and probably encouraged even. I have written several self-answered Q&A here and they were mostly well-received. They aren't all that easy to write though, especially getting the ...

posted 2y ago by Lundin‭

Answer
71%
+3 −0
Meta Renaming GNU/Linux tag to gnu

I don't think GNU can be used as a stand-alone tag. Apart from the OS, GNU is also a tool collection of various programs, many used for programming, making is a very ambiguous tag which can't stan...

posted 2y ago by Lundin‭

Answer
70%
+5 −1
Q&A Terms for types of functions with respect to side effects

I don't think there are any formal names for the various versions you list. First of all, please note that output in a programming context most often refers to printing something on a screen or to...

posted 1y ago by Lundin‭  ·  edited 1y ago by Lundin‭

Answer
70%
+5 −1
Q&A Why is global evil?

The basics of good vs bad program design All programs are divided in classes. (Or modules/abstract data types/interfaces etc - a rose by any other name.) Each class should only be concerned with i...

posted 1y ago by Lundin‭  ·  edited 1y ago by Michael‭

Answer
66%
+4 −1
Meta Meaning of the tag software practices?

Some new tag "software practices" just popped up, no wiki. What's the purpose of this tag and how is it useful? What exactly in software development is not "software practices"? Seems quite superfl...

1 answer  ·  posted 4y ago by Lundin‭  ·  last activity 4y ago by Moshi‭

Question discussion tags
66%
+2 −0
Q&A Storing more bytes than a union member has, but less than the union size, with memcpy(3)

memcpy(&y.t, &x, sizeof(x)); is a bit fishy since it would have made more sense to copy into &y or &y.s. None of this is necessarily UB however. Regarding strict aliasing, it doesn...

posted 2y ago by Lundin‭  ·  edited 2y ago by Lundin‭

Answer
66%
+2 −0
Q&A Can freed pointers undergo lvalue conversion?

p is assigned a value and then it becomes indeterminate when the pointed at object has reached the end of its lifetime (C17 6.2.4). Pointers may have trap representations (C17 6.2.6.1/5) and in ca...

posted 2y ago by Lundin‭

Answer
66%
+2 −0
Meta How to best ask about algorithmic problems

This question was of very poor quality and should have been closed. I closed it but someone disagreed, for reasons unknown. I'm not sure if it's an actual algorithm question or just a request for f...

posted 3y ago by Lundin‭  ·  edited 3y ago by Lundin‭

Answer
66%
+2 −0
Q&A How does the strict aliasing rule enable or prevent compiler optimizations?

Pointer conversions and aliasing First of all, C historically allows all manner of crazy pointer conversions (whereas C++ is more restrictive) between compatible and non-compatible pointed-at type...

posted 4mo ago by Lundin‭  ·  edited 3mo ago by Lundin‭

Answer
66%
+2 −0
Q&A typeof_unqual behaves differently in gcc and clang

C23 6.7.3.6 contains this (informative) example demonstrating the use of typeof_unqual: const char* const animals[] = { "aardvark", "bluejay", "catte", }; typeof_unqual(animals) anima...

1 answer  ·  posted 4mo ago by Lundin‭  ·  edited 4mo ago by hkotsubo‭

Question c gcc clang c23 typeof
66%
+2 −0
Q&A What does the greater than 0 indicate in the case of this statement 'if (compare(A[j], A[j+1]) > 0)' ? Thank you.

Generally speaking, comparison callback functions in C are often implemented to return an integer lesser than zero, equal to zero or greater than zero - depending on if the first object is lesser t...

posted 3y ago by Lundin‭

Answer
66%
+4 −1
Q&A What's the difference between null pointers and NULL?

Someone told me that I shouldn't write "NULL pointer" with capital letters, because a null pointer and NULL are different terms. And that NULL is a "null pointer constant". What's the meaning of th...

3 answers  ·  posted 4y ago by Lundin‭  ·  last activity 4y ago by EJP‭

66%
+2 −0
Meta Give actionable feedback when closing questions

We rather need to make a close reason for every kind of off-topic reason. In this specific case, the reason could for example be Purely subjective question rather than the old "primarily opinion-ba...

posted 4y ago by Lundin‭

Answer