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 |
---|---|---|---|---|
Comment | Post #286185 |
You are right, I wrote recursion, but in fact had the stack based approaches in mind. I changed my answer with respect to this point. (more) |
— | 3 months ago |
Comment | Post #288669 |
Hi Markus, I suggest to add this as a separate question. Then, more people will see it and can help you. I may not be able to look into it during the next days. (more) |
— | 8 months ago |
Comment | Post #288771 |
Thanks for the clarification - I understand that there are in fact two relations, one being the relation you mentioned: "pairs (a, b) and (x, y) are equal when either a = x or b = y" which is not an equivalence relation (and that was what my comment was pointing at), but which "generates" another rel... (more) |
— | 10 months ago |
Comment | Post #288771 |
Assume the pairs (1,a), (2,a), (2,b), (3,b) are given. Wouldn't then {1,2,3} have to be in one set, and {a,b} as well? The pairs (1,a) and (3,b), however, do not fit the proposed equivalence relation. (more) |
— | 10 months ago |
Comment | Post #287313 |
Sorry, I don't get it. Please provide one or better more examples of the inputs and the expected outputs. Moreover, also provide what you have tried yourself so far. Also, please try to be syntactically clean. Your listA is not a valid list, and thus it is not clear what you mean it to represent.... (more) |
— | over 1 year ago |
Comment | Post #286974 |
This goes then in a different direction:
* From a pure C perspective, there is no issue with global variables being uninitialzed. Global variables are always initialized. If you don't given an explicit initializer, they are implicitly initialized to 0.
* In your case, you are dealing with glo... (more) |
— | over 1 year ago |
Comment | Post #286979 |
A cast `(t)e` performs a conversion of the result of expression `e` to type `t`. Expression `e` in this case actually is a an lvalue expression. The cast to `void` in this case may give the compiler the possibility to optimize away the whole expression, but that is to my knowledge not mandatory, bu... (more) |
— | over 1 year ago |
Comment | Post #286974 |
What is the reason you want to do this, and what would be your intended behavior? It may be possible, but maybe the result / effect is still not what you are hoping for. (more) |
— | over 1 year ago |
Comment | Post #286720 |
If the compiler _knows_ that there are no side effects, it can perform all kinds of optimizations. And, for the std::string constructor the compiler knows there are no side effects, as it is defined by the standard. The copy elision rules only have relevance where there are known side effects or wh... (more) |
— | almost 2 years ago |
Comment | Post #286628 |
To improve readability I would recommend some different name, that also makes the role of the argument more obvious, for example `assert_not_in_binary_if(cond)`. (more) |
— | almost 2 years ago |
Comment | Post #286530 |
I agree that a statemachine usually does not receive "actions" but rather events (or "information", as you say).
However, I don't think raising exceptions is a design error. Often there are states which can not plausibly receive certain events. Think of a state machine with states A and B, where o... (more) |
— | almost 2 years ago |
Comment | Post #286440 |
The source code you have pasted is garbled, as if you have pasted it twice. Moreover, it is not clear a) what output you have got and b) what output you would have expected. I don't get the meaning of "the pid that work only one time" - pid is a variable in your code. (more) |
— | almost 2 years ago |
Comment | Post #286351 |
I would phrase it slightly differently, namely that in your example scenario there would always be two different cases that at run-time would have to be distinguished. Keep in mind that the distinction could also be made by some indirect call through a virtual function table, where, depending on the... (more) |
— | almost 2 years ago |
Comment | Post #286352 |
The stack that a computer program implicitly uses is built of so called stack frames. Whenever a function is called, a new stack frame is created "on top of the stack".
Each stack frame contains information that allows the program to return from the currently executed function to the calling func... (more) |
— | almost 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 |
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 |
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 |
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 |
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 |