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.

Activity for Dirk Herrmann‭

Type On... Excerpt Status Date
Edit Post #286373 Post edited:
almost 2 years ago
Edit Post #286373 Post edited:
almost 2 years ago
Suggested Edit Post #286372 Suggested edit:
The question is about operator precendence rather than type coercion. I was thinking also about changing the title in this direction...
(more)
helpful almost 2 years ago
Edit Post #286373 Initial revision almost 2 years ago
Answer A: Explaining the result of an arithmetic expression in JavaScript
The concept that is important to understand here is the concept of operator precedence. Assume you have an expression `a + b c`. What does it mean? You could have the following options: `(a + b) c` or `a + (b c)`. By adding the parentheses it can be made clear what shall be computed first, b...
(more)
almost 2 years ago
Edit Post #286352 Post edited:
Added the sticky notes to be able to represent variables on the stack.
about 2 years ago
Edit Post #286352 Post edited:
about 2 years ago
Edit Post #286352 Initial revision about 2 years ago
Answer A: How this recursive treewalker works?
To understand the concept of recursive tree traversal, I would like to give you an analogy. Imagine a labyrinth of rooms connected like a tree structure. That is, there is an entry to the first room, and when entering a room you may find doors leading into rooms deeper down into the labyrinth, but ...
(more)
about 2 years ago
Comment Post #286349 Just for my understanding: Are you in principle familiar with the concept of recursion and you only want to understand why in this case it works with the given code? Or is the concept of recursion as such new to you?
(more)
about 2 years ago
Edit Post #286351 Post edited:
about 2 years ago
Edit Post #286351 Initial revision about 2 years ago
Answer A: How this recursive treewalker works?
Note: This answer was written for a version of the question that focused on getting rid of the if-else, rather than on an explanation of the workings of the recursive tree-traversal. One way of getting rid of if-elses to achieve uniform handling of different objects is to hide the distinction in l...
(more)
about 2 years ago
Comment Post #286349 What is the goal that you want to achieve? Why do you want to avoid using an if-else?
(more)
about 2 years ago
Edit Post #286350 Post edited:
about 2 years ago
Edit Post #286350 Post edited:
about 2 years ago
Edit Post #286350 Initial revision about 2 years ago
Answer A: Recursion without a procedure ("function") in JavaScript
There are several ways to turn a recursive algorithm into an iterative one or at least avoid to do the recursive calls in your own code. In the specific example of yours, where your traverse a tree, some possibilities are: You can create a stack data structure explicitly that corresponds to the ...
(more)
about 2 years ago
Edit Post #286248 Initial revision about 2 years ago
Answer A: How to delete contents of a specific field, if it matches a pattern and there is nothing else in the field
For the regular expression to only match a full field of hyphens, you have, as others already have explained, to put the `^` anchor at the begin of the regular expression and the `$` anchor at the end and make it clear that you are interested in a sequence of hyphens by adding a `+` after the hyphen....
(more)
about 2 years ago
Edit Post #286194 Post edited:
Small typo
about 2 years ago
Suggested Edit Post #286194 Suggested edit:
Small typo
(more)
helpful about 2 years ago
Edit Post #286198 Initial revision about 2 years ago
Answer A: Should I check if pointer parameters are null pointers?
To extend a bit on some points already mentioned: Regarding where to add checks on a case by case basis: If you have a static code analysis tool that can give you information about areas where provably no null pointer will be passed / no undefined behavior can occur, you can omit the checks in the...
(more)
about 2 years ago
Edit Post #286185 Post edited:
about 2 years ago
Edit Post #286185 Initial revision about 2 years ago
Answer A: Detecting balanced parentheses in Python
> Is this a good approach? How can I improve my algorithm? Your code is correct and simple. That is good, and it may be all that is needed. You have received some responses that indicate that there would be a performance problem. But, whether or not performance is an issue, and what the precise...
(more)
about 2 years ago
Edit Post #286160 Initial revision about 2 years ago
Answer A: A class to access dicts using attribute syntax
I like the idea, but more as an exercise or a demonstration what can be done with Python. I also like that the code comes with a set of test cases which are written in a way that they nicely serve as user documentation. In fact, I could even imagine this example being used in a tutorial about the `...
(more)
about 2 years ago
Comment Post #286152 I see, and yes, as I wrote, this kind of anti-social behaviour might actually require some special handling. I mean, there are different reasons why a question is not good: It might be unclear etc., but that is not necessarily anti-social. Having a special handling for this might make it even clear...
(more)
about 2 years ago
Edit Post #286152 Initial revision about 2 years ago
Answer A: Questions easily answered by studying a beginner-level book
What if a question is beginner level? I would say: Someone should answer it. Some of the beginner level questions on stackoverflow have received answers that explain things in wonderful ways. Beginner level questions are formulated in the way beginners ask questions. Experienced people forgot...
(more)
about 2 years ago
Edit Post #286131 Post edited:
Fixed: had used foo instead of ptr...
about 2 years ago
Comment Post #285836 Well, more precisely it is the number of binary branches in the control flow plus one. Three `if`s in a row correspond to 8 execution paths, but the cyclomatic complexity is just 4. The number of paths can even be infinite (in case of loops), while a loop condition will only contribute 1 to the cyc...
(more)
about 2 years ago
Comment Post #286135 Where did you observe this exit code? Was this some program you had written yourself? Could you show the relevant parts of the code?
(more)
about 2 years ago
Edit Post #286131 Initial revision about 2 years ago
Answer A: What does a variable followed by parentheses ("ptr()") mean?
> What does `ptr()` mean in this code? An expression like `ptr` followed by parentheses as in `ptr()` is a function call. In your example, `ptr` is a variable of type "pointer to function" because of the declaration `void (ptr)()`. That is, `ptr()` will call the function that the variable `ptr` ...
(more)
about 2 years ago
Comment Post #285556 While I agree with the rest of your post, I object to the statement "[...] the `size % 8` bytes [...] where unused. You could write into these bytes [...]". Whether or not these bytes are used depends on the implementation of malloc and possibly other aspects. For example, malloc could store manag...
(more)
about 2 years ago