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‭

143 posts
75%
+4 −0
Q&A What might happen if I ignore warning?

Warnings most often mean "here is a bug which will likely cause your program to crash or misbehave". They do not mean "here's something that you can optionally fix when you can spare the time". See...

posted 2y ago by Lundin‭  ·  edited 2y 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
75%
+4 −0
Meta Sorting answers by score appears to be broken

https://software.codidact.com/posts/277536/278390?sort=score At the point when I'm posting, the answer by Lundin has +14 score and the answer by dmckee‭ has +11 score. Neither has any down votes. ...

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

Question bug status-bydesign
85%
+10 −0
Q&A How to declare variable-length arrays correctly?

C programs are executed from top to bottom. You can't declare a VLA with an uninitialized variable as its size parameter. For the same reason at you can't do this: int x; printf("%d\n",x); scanf...

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

Answer
83%
+8 −0
Q&A How to declare variable-length arrays correctly?

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

1 answer  ·  posted 3y ago by Lundin‭  ·  last activity 9mo ago by Lundin‭

83%
+8 −0
Q&A What's the difference between Inheritance and Polymorphism?

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

posted 3y ago by Lundin‭

Answer
71%
+3 −0
Q&A Why does this code that uses a pointer-to-pointer-to-int segfault?

Bugs: int **range = 0; should be int *range; and then call the function like ft_ultimate_range(&range, min, max);. That's the whole reason the parameter is pointer-to-pointer, so that you c...

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

Answer
83%
+8 −0
Code Reviews BMPL: The language I'll bring to life

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

posted 3y ago by Lundin‭

Answer
88%
+13 −0
Q&A What compiler options are recommended for beginners learning C?

My recommended beginner setup for gcc-like compilers is: -std=c11 -pedantic-errors -Wall -Wextra -Werror Here is an explanation of what these options do: -std=c11. gcc & friends are by d...

posted 3y ago by Lundin‭

Answer
87%
+12 −0
Q&A What compiler options are recommended for beginners learning C?

When reading questions about C programming from beginners, I very often see them describing peculiar run-time errors and crashes, segmentation faults and similar. They have spent a lot of time chas...

1 answer  ·  posted 3y ago by Lundin‭  ·  edited 2y ago by Lundin‭

83%
+8 −0
Q&A constructor in C

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

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

Answer
75%
+4 −0
Meta Can we migrate office suite related questions to the Power Users community?

I went ahead and made a proposal on Power User that a separate category for office suites should be made. I suggest that we wait and see where that proposal lands. If a category for these question...

posted 3y ago by Lundin‭  ·  edited 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
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
83%
+13 −1
Q&A Is strcpy dangerous and what should be used instead?

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

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

Answer
88%
+14 −0
Q&A Is strcpy dangerous and what should be used instead?

I heard rumours that the strcpy function is dangerous and shouldn't be used. Supposedly it can be exploited to create buffer overflows somehow. And indeed when I compile my C code in the admittedl...

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

71%
+3 −0
Meta Code formatting of previews

I just noticed that I'm not getting code formatting in the preview window when I write an answer or make an edit. This is very useful to have. Not sure if it's a bug so I'm posting this as a featu...

0 answers  ·  posted 3y ago by Lundin‭  ·  edited 3y ago by Monica Cellio‭

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
75%
+4 −0
Q&A Multiple catches with almost the same code.

There are many things we label as bad when programming, for various reasons. Repeating code is slightly bad. But writing function like-macros is extremely bad. You should not try to replace someth...

posted 3y ago by Lundin‭

Answer
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
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
86%
+11 −0
Q&A What is CPU endianness?

This goes back to the various CPU architecture "wars" in the 1970s-1980s between the competitors Intel and Motorola (for example Intel 8086 vs Motorola 68000). For various reasons, CPUs from these ...

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

Answer
85%
+10 −0
Q&A What is CPU endianness?

I was fooling around with the following C code on my trusty old x86 PC: #include <stdint.h> #include <stdio.h> int main (void) { uint32_t u32 = 0xAABBCCDD; uint8_t* ptr = (u...

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

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

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

posted 3y ago by Lundin‭  ·  edited 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 6mo ago by Karl Knechtel‭

Question c code-style macros