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‭

142 posts
81%
+7 −0
Meta Are code troubleshooting posts allowed?

You are right, the on-topic page is confusing - trouble-shooting and general programming questions should obviously be on-topic! Perhaps we considered it so obvious that it fell between the lines ...

posted 3y ago by Lundin‭

Answer
81%
+7 −0
Q&A How allocated memory is calculated?

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...

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

Answer
81%
+11 −1
Meta Should we allow questions about installation and configuration of software development tools?

Generally, I would say: On-topic How to install, configure, trouble-shoot and use tools specifically meant for software development. Compilers, debuggers, IDEs and so on. Asking questions rega...

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

Answer
80%
+6 −0
Q&A What's the difference between null pointers and NULL?

There are three different, related concepts that are easy to mix up: null pointers null pointer constants the NULL macro Formal definitions The first two of these terms are formally defined in C1...

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

Answer
80%
+6 −0
Q&A Are static pointers implicitly initialized to NULL?

Yes, it is guaranteed to evaluate to true. All variables with static storage duration are set to zero in case of arithmetic types or set to null in case they are pointers. The relevant part is C17 ...

posted 2y ago by Lundin‭

Answer
80%
+6 −0
Q&A Why does fopen return NULL?

The simple explanation would be that you simply don't have write access to the path, which is one possibility. Another weird phenomenon that may happen is that you are running a very old C...

posted 2y ago by Lundin‭

Answer
80%
+6 −0
Q&A Common string handling pitfalls in C programming

The reader is assumed to understand how arrays and pointers work in C. You cannot understand pointers before you understand arrays, and you cannot understand strings before you understand pointers ...

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

Answer
80%
+6 −0
Q&A How to write a macro that discards the const qualifier, for any type?

Ignoring the numerous forms of undefined behavior that casting away const might invoke, the blunt but simple and standard solution is just to cast to (void*). char* foo (const char* str) { r...

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

Answer
80%
+6 −0
Q&A What is the meaning of "short circuit" operators?

When reading about various operators used by programming languages, the term "short circuit behavior" is often used. For example in this C code: int a = 0; a && b++ Someone explained t...

2 answers  ·  posted 7mo ago by Lundin‭  ·  last activity 7mo ago by matthewsnyder‭

80%
+6 −0
Q&A Is `uint8_t` always an alias for a character type if it exists?

Yes, it is in practice always a character type and you can safely assume as much, both in terms of (g)lvalue access and in terms of strict pointer aliasing. If not, the compiler would soon render i...

posted 3y ago by Lundin‭

Answer
78%
+9 −1
Meta Etiquette for posting comments

Regarding "snark" - it is very hard and subjective to define. Our overall code of conduct says "be nice", but where do you draw the line. On SO, general gruff attitude tends to be treated very diff...

posted 3y ago by Lundin‭

Answer
78%
+9 −1
Q&A What is do { } while(0) in macros and should we use it?

Background I can see the need to use { } when implementing a function-like macro such as this one: #define HCF(code) fprintf(stderr, "halt and catch fire"); exit(code); Because if we use the f...

2 answers  ·  posted 3y ago by Lundin‭  ·  last activity 5mo ago by Karl Knechtel‭

Question c code-style macros
77%
+5 −0
Q&A Are there technical reasons to pick one struct coding style over the other?

C offers two different styles when it comes to structs (and union/enum too). Either declare them using a struct tag only ("struct tag style"): struct my_type { ... }; struct my_type x; Or ...

1 answer  ·  posted 2mo ago by Lundin‭  ·  last activity 2mo ago by Lundin‭

Question c code-style struct
77%
+5 −0
Q&A Are there technical reasons to pick one struct coding style over the other?

Arguments in favour of "struct tag style": Less namespace clutter. C has a peculiar name space system where all identifiers belong to one of: labels, tags, members, ordinary. Struct tag style...

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

Answer
77%
+5 −0
Q&A Cast uninitialized variable to (void)

It depends. This boils down to whether or not the expression cast to void contains any side effects, such as accessing a volatile-qualified object or modifying any object. C17 6.3.2.2: If an ex...

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

Answer
77%
+12 −2
Q&A What gets allocated on the stack and the heap?

I was told by my professor/book that computer programs use two kinds of memory and that all variables get allocated either on the stack or on the heap. Is this true? How can I tell where a variable...

2 answers  ·  posted 3y ago by Lundin‭  ·  edited 3y ago by Alexei‭

77%
+5 −0
Q&A Can I access an array element from a pointer to an object contiguous with but outside the array?

The problem with undefined behavior due to array out of bounds happens whenever we use pointer arithmetic, which is only defined to work within the bounds of an array. Where plain variables, "scala...

posted 29d ago by Lundin‭  ·  edited 29d ago by Lundin‭

Answer
77%
+5 −0
Meta Software recommendations category

At some extent, you can ask about (programming-related) software recommendations if you manage to narrow down the scope to something specific. A question like "which one of compiler x and compiler ...

posted 2y ago by Lundin‭

Answer
77%
+5 −0
Q&A Is it OK to use scanf with a void pointer?

Void pointers are compatible with every other object pointer type and as mentioned in another answer, 7.21.6/10 speaks of the type of the pointed at object, not the type of the pointer. This is con...

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

Answer
77%
+5 −0
Q&A Common string handling pitfalls in C programming

Preface: This is a self-answered Q&A meant as a C string handling FAQ. It will ask several question at once which isn't ideal, but they are all closely related and I'd rather not fragment the p...

1 answer  ·  posted 2y ago by Lundin‭  ·  last activity 2y ago by Lundin‭

77%
+5 −0
Meta Are general questions (hopefully resulting in comprehensive, 'canonical' answers) in scope

Generally these questions are fine, though they should come with specific examples, so that they become clearer and can get narrowed-down. I've done a lot of self-answered Q&A here and the hard...

posted 2y ago by Lundin‭

Answer
77%
+5 −0
Meta Is this a good fit for Code Reviews, and if so, how to best post it?

400 lines is not that big, it should be fine to post the complete program below the Code Reviews post category. I'd post it as separate code formatted blocks with one block per file indeed. A revi...

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

Answer
77%
+5 −0
Q&A Write to same file from multiple threads

Writing to the file on the HD is your massive bottleneck no matter how many threads you throw around. The limit is the physical memory access speed, not processing power. And since it is such a bot...

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

Answer
77%
+5 −0
Q&A Warn of implicit cast in a function's arguments with GCC?

You can use -Wconversion but you should be aware that it is very prone to false positives. It's a good flag to turn on during code review etc to shake out a few minor issues, but it's not a flag yo...

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

Answer
77%
+5 −0
Meta What is our policy on tags?

Luckily, we are in a position where we don't have to re-invent the wheel. We can see what went either wrong or horribly wrong at SO, then avoid making the same mistakes. Some common problems: Maki...

posted 3y ago by Lundin‭

Answer