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.

Search

Advanced Search Options

To further refine your search, you can use additional qualifiers such as score:>0.5. For example, the search score:>=0.5 created:<1y grammar would return only posts mentioning "grammar" that have a score >= 0.5 and were created less than a year ago.

Further help with searching is available in the help center.

Quick hints: tag:tagname, user:xxx, "exact phrase", post_type:xxx, created:<N{d,w,mo,y}, score:>=0.5

Filters
 
80%
+6 −0
Q&A How to compare a git stash to the current working tree?

In git you can put your current changes aside for a moment with git stash. This is really neat but what often ends up happening is that you forget what was in there, and what was the state of the b...

1 answer  ·  posted 1y ago by Iizuki‭  ·  edited 1y ago by Iizuki‭

Question git git-diff git-stash
80%
+6 −0
Q&A How do I share a type between a client and server, but make a specific field optional for one and required for the other?

Let's say I have a client/server application with a data structure on the server side: type User = { name: string; superSecretGovernmentIdNumber: string; }; These fields are both non-nul...

2 answers  ·  posted 1y ago by Emily‭  ·  last activity 1y ago by Jacob Raihle‭

Question typescript
80%
+6 −0
Q&A What are the benefits of starting a Git repo with an empty commit?

This sounds to me like someone had a problem once and they've decided upon a somewhat silly way to keep that from ever happening again. The big repository hosts have a different way of addressing ...

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

Answer
80%
+6 −0
Q&A How and where does Python code start running? How can I control that?

Suppose I have some code in a file myscript.py like: def my_function(): print("Test") What steps do I need to take in order to make my_function run? That is to say: how do I get Python to ...

2 answers  ·  posted 1y ago by Karl Knechtel‭  ·  last activity 11mo ago by Michael‭

Question python startup entry-point
80%
+6 −0
Q&A Can I access an array element from a pointer to an object contiguous with but outside the array?

C prohibits accessing an array out of bounds even if measures were taken to ensure that what should lie outside those bounds were known: struct MyStruct { int x[2]; int y, z; }; static...

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

Question c undefined-behavior array
80%
+6 −0
Q&A Why is global evil?

Global variables make the code hard to reason about This is especially visible when debugging. Say you have a function which errors. The stacktrace tells you where the function got it's arguments,...

posted 1y ago by Iizuki‭

Answer
80%
+6 −0
Q&A Behavior of Pointer Arithmetic on the Stack

Not only does the C language not guarantee it, it also will fail on actual compilers, as soon as you enable optimisation (which you'll generally want to do because you want your code run fast, afte...

posted 3y ago by celtschk‭

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

Answer
80%
+6 −0
Q&A How to delete contents of a specific field, if it matches a pattern and there is nothing else in the field

You're matching the regex pattern of /-/, so it just matches every individual hyphen, regardless of where. You want to match the entire entry if it's only hyphens, or /^-+$/. ^ – Beginning of line...

posted 3y ago by Ullallulloo‭

Answer
80%
+6 −0
Q&A TypeScript is unable to infer the correct type for a mapped tuple

I was playing around with mapped tuples and came across an interesting case where TypeScript cannot infer the types used: interface Foo<A, B> { (a: A, b: B): any } function test<...

0 answers  ·  posted 3y ago by Moshi‭  ·  edited 1y ago by Moshi‭

Question typescript mapped-types type-inference
80%
+6 −0
Q&A How to delete contents of a specific field, if it matches a pattern and there is nothing else in the field

The awk gsub function takes as its first argument a regular expression indicating the substring to be replaced, and replaces a matching substring with the value of the second argument, which is the...

posted 3y ago by Canina‭

Answer
80%
+6 −0
Q&A When using the compare function in Array.prototype.sort, how to avoid an element to be processed more than once?

When using the Array.prototype.sort method, we can pass a compare function as argument. Then, this function can be used to process array's elements, so the comparison is made using some custom crit...

2 answers  ·  posted 3y ago by hkotsubo‭  ·  last activity 2y ago by matthewsnyder‭

Question javascript array sorting
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 3y ago by Lundin‭

Answer
80%
+6 −0
Q&A How to properly use malloc?

TL;DR You should use int *p = malloc(n * sizeof *p); for two reasons The cast (int*) is not necessary, which means it's clutter. Using sizeof *p instead of sizeof(int) removes code duplica...

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

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

Consider this code: #include <stdio.h> int main(void) { static void *ptr; if(ptr == NULL) puts("It's NULL!"); } I wonder if this is guaranteed to print "It's NULL!" I know ...

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

Question c pointers language-lawyer
80%
+6 −0
Q&A Change font-family with JavaScript

To do that, you could change the selector from body to *, as the other answer said. By selecting only body, it won't change child elements that has defined a more specific rule, and that's why you ...

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

Answer
80%
+6 −0
Q&A How kill a child process without read() hanging in the parent process?

There is an external program I'm calling from within my C/C++ program, by using fork() and execl(), and redirecting the stdio with dup2() to be able to read the output from the external program. I...

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

Question c++ linux fork execl child-process
80%
+6 −0
Q&A Are there any downsides related to using Maybe or Optional monads instead of nulls?

In my opinion, all of the downsides boil down to two objections: It isn't idiomatic (in C# and VB.⁠NET) It's slightly less performant The fact that it isn't idiomatic means that, as you note...

posted 3y ago by r~~‭

Answer
80%
+6 −0
Q&A Separate digits of a number in groups with different sizes

Before we start, I'd like to be a little bit pedantic regarding 00002451018 being a number. When we talk about numeric types/values, the zeroes at the beginning are irrelevant: 2, 02 and 000002 al...

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

Answer
80%
+6 −0
Q&A Are there any downsides related to using Maybe or Optional monads instead of nulls?

I have recently stumbled across the Maybe (or Optional) modal usage in .NET Code: example code or this one example article Based on everything I read, there are multiple advantages on relyi...

2 answers  ·  posted 3y ago by Alexei‭  ·  last activity 3y ago by Derek Elkins‭

Question .net functional-programming monads maybe
80%
+6 −0
Q&A Is it possible to undo a git reset?

From the Git docs "reset" copies the old head to .git/ORIG_HEAD To restore that commit, you can run $ git reset ORIG_HEAD If you want to restore more than one reset, then you'll have to l...

posted 3y ago by Moshi‭

Answer
80%
+6 −0
Q&A array of arrays vs array of pointers to store array of string literals

Let's consider the following code: const char a[][4] = {"aa", "aaa"}; const char *b[] = {"bb", "bbb"}; const char *const c[] = {"cc", "ccc"}; For shared libraries, both b and c arrays require...

0 answers  ·  posted 3y ago by alx‭  ·  edited 3y ago by alx‭

Question c pointers array linker string-literals
80%
+6 −0
Code Reviews Measuring the impact of using exceptions instead of return values in an ASP.NET Core application

Context This Q&A from SO suggests that throwing exceptions is incredibly expensive when compared to returning values (return codes): that with return codes instead of exceptions the same pr...

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

Question asp.net-core exception benchmarking
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 3y ago by Lundin‭  ·  edited 3y ago by Lundin‭

Answer
80%
+6 −0
Meta Should I post a link to the Github repo for code reviews?

Hello. Total noob here and noob to this site. I've written a non-trivial program in Python. Code review didn't take the whole thing (400+ lines of code). Should I post a link to my Github repo ...

3 answers  ·  posted 3y ago by joe‭  ·  last activity 2y ago by matthewsnyder‭

Question discussion questions