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
92%
+21 −0
Q&A What must a C compiler do when it finds an error?

The C standard does not speak of "errors" and "warnings", those are not formal terms. The compiler is only required to produce a diagnostic message, as specified in C11 5.1.1.3: Diagnostics A c...

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

Answer
91%
+20 −0
Meta Getting rid of "company tags" early on

So it appears that we've gotten our first "company tag", Apple. We know from SO that company name tags were always problematic since: Questions are about products, not companies. Given that the pr...

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

Question discussion tags
90%
+18 −0
Q&A What must a C compiler do when it finds an error?

What exactly must a C compiler do when it finds a compile-time error? The most obvious kind of errors are language syntax errors, but the C standard also speaks of constraints, which are rules tha...

1 answer  ·  posted 3y ago by Lundin‭  ·  edited 2y ago by ghost-in-the-zsh‭

90%
+16 −0
Meta How can we grow this community?

By having decent source code formatting that isn't completely inferior to other sites like Stack Overflow. We might want to post/view snippets longer than 13 lines without suffering some scroll whe...

posted 2y ago by Lundin‭

Answer
90%
+16 −0
Q&A How to do private encapsulation in C?

The concept you are looking for is referred to as opaque type or opaque pointers. This is the proper method to achieve private encapsulation in C and can also be used for inheritance/polymorphism (...

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

Answer
89%
+15 −0
Meta Growing software.codidact

We can't go and shamelessly promote Codidact in SO comments etc just for the sake of it - that's regarded as spamming and might get you banned, plus it will give Codidact a nasty rep. Similarly, SE...

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

88%
+14 −0
Meta Should we allow answers generated by ChatGPT?

After some more experience from this bot over a couple of months, I would say that we should ban it simply because: The answers it gives are often wrong. ChatGPT has been hyped up ridiculously. I...

posted 1y ago by Lundin‭

Answer
88%
+14 −0
Q&A What gets allocated on the stack and the heap?

"Stack vs heap" is a common over-simplification and not really a meaningful one, since those two areas have quite different, specialized uses. And no, those are not the only memory regions used by ...

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

Answer
88%
+13 −0
Q&A What is undefined behavior and how does it work?

Undefined behavior (informally "UB") is a formal term in the C language, defined in C17 3.4.3 undefined behavior behavior, upon use of a nonportable or erroneous program construct or of erroneous ...

posted 3y ago by Lundin‭  ·  edited 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
88%
+13 −0
Q&A Is omitting braces for single statements bad practice?

Not using braces is considered bad practice by widely recognized industry coding standards (MISRA-C:2012 rule, 15.6, CERT C EXP19-C and others). Once upon a time I liked to skip out braces too, bu...

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

87%
+12 −0
Q&A What does the static keyword do in C?

What exactly does the static keyword do in C? I have seen it used in several diverse contexts: 1) As a variable outside a function: #include <stdio.h> static int x = 5; int main (void) ...

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

86%
+11 −0
Q&A How to do private encapsulation in C?

I'm using an object-oriented design for my C project and trying to implement classes with private encapsulation. How do I do this? Some things I've tried that are problematic: Using a struct f...

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

86%
+11 −0
Meta Should posting on Meta affect reputation?

Codidact has already managed somewhat to separate domain knowledge from moderator suitability. So far so good, but reputation is also a measurement of activity. It might make sense that being acti...

posted 10mo ago by Lundin‭

Answer
86%
+11 −0
Q&A What is undefined behavior and how does it work?

I have created this sensational program: #include <stdio.h> int* func (void) { int local=5; return &local; } int main (void) { printf("%d\n", *func()); } This prints 5 even thoug...

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

86%
+11 −0
Q&A Should I check if pointer parameters are null pointers?

When writing any form of custom function such as this: void func (int* a, int* b) Should I add code to check if a and b are null pointers or not? if(a == NULL) /* error handling */ When po...

4 answers  ·  posted 2y ago by Lundin‭  ·  last activity 2y ago by Dirk Herrmann‭

86%
+11 −0
Q&A Behavior of Pointer Arithmetic on the Stack

Generally speaking, pointer arithmetic is undefined behavior unless carried out on arrays. This is how the additive operators behave, C17 6.5.6: For the purposes of these operators, a pointer to...

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

Answer
86%
+11 −0
Q&A What does the static keyword do in C?

Storage class specifiers static is strictly speaking a storage class specifier, which is an attribute given to a variable or a function stating how it is allocated, how it is accessible and how lo...

posted 2y ago by Lundin‭  ·  edited 11mo 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 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 2y ago by Lundin‭  ·  edited 8mo ago by Lundin‭

Answer
85%
+10 −0
Q&A Is it undefined behaviour to just make a pointer point outside boundaries of an array without dereferencing it?

Yes, the second line invokes undefined behavior. First of all, according to C17 6.5.2.1 regarding array subscripting, an expression E1[E2] is just "syntactic sugar" for *((E1)+(E2))). So what appli...

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‭

85%
+16 −1
Meta The size of the code format window is much too small.

When posting a lot of code on the site, the "code format window" is much too small: 1 I'm talking about this thing 2 3 4 5 6 7 8 9 10 11 12 13 14 15 The scroll bar appears after...

3 answers  ·  posted 3y ago by Lundin‭  ·  last activity 1y ago by trichoplax‭