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 Lundinâ€
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Answer | — |
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 6.7.9/10: > If an object that has automatic storage duration is not initialized explicitly, its value... (more) |
— | about 2 years ago |
Comment | Post #285899 |
The forgetting stdlib.h argument was what once started the whole "don't cast the result" business, where otherwise people wouldn't care much about the cast. Bugs caused by C90 implicit int are _not_ fun to debug, they are subtle as sin. It was a very valid argument back in the 1990s. Today, not so mu... (more) |
— | about 2 years ago |
Comment | Post #285899 |
The difference between `(int*)malloc` and `(int)42` is that malloc does actually return a different type. In your integer examples, the type is already the expected `int`. Furthermore, the C language does actually not allow _any_ implicit pointer conversions except during pointer assignment. 6.5.4 _C... (more) |
— | about 2 years ago |
Edit | Post #285910 | Initial revision | — | about 2 years ago |
Answer | — |
A: How to properly use malloc? Should we cast the result of malloc? The cast to the intended type is not necessary in C, since during assignment, the `void` returned by `malloc` can be implicitly converted to any other object pointer and vice versa (as per C17 6.5.16.1). So the cast does add clutter. However, there's nothing wr... (more) |
— | about 2 years ago |
Comment | Post #285826 |
It's the very same thing as I mentioned here: https://software.codidact.com/posts/278910/278932#answer-278932. In fact I've stopped writing self-answered Q&A on SO and post all such content here instead. Because such posts tend to be of significantly higher quality than the average Q&A (and require a... (more) |
— | about 2 years ago |
Comment | Post #285875 |
So how about dropping the latter part of that sentence and go with something like "Best practices as long as a clear 'best' criteria is present. Examples could be: what code gives fastest execution, least memory use, widest tool support for a target, most beginner-friendly IDE for a certain language ... (more) |
— | about 2 years ago |
Comment | Post #285875 |
I think the rationale for the "best" criteria needs to be there to prevent really bad questions like "what compiler is best". Asking "what compiler is best _for a beginner using Windows_" is however quite some improvement of that question. Perhaps this should be rephrased focusing on the quality of t... (more) |
— | about 2 years ago |
Edit | Post #285870 | Initial revision | — | about 2 years ago |
Question | — |
A cleanup of "What type of questions can I ask here?" What type of questions can I ask here? has gotten rather cluttered since we have added/removed a lot of things along the way. In particular, I think it is hard to get an idea of what's on-topic by just taking a glance at it. Proposed changes: 1) Move the text directly below on-topic to a separa... (more) |
— | about 2 years ago |
Comment | Post #285836 |
Since cyclomatic complexity is the number of possible execution paths, it is expected behavior. What one can do is to keep switches simple - if they only check an integer enum which has a contiguous sequence, the switch will get optimized well. In case of floating point or strings etc, not so much. T... (more) |
— | about 2 years ago |
Comment | Post #285813 |
Similarly, how can you explain passing a function to a function, is this pass by value: `void func (void f(void));` Of course not. (more) |
— | over 2 years ago |
Comment | Post #285813 |
"if you want to pass a reference to an object you always have to be explicit about it" How do you explain this then? `void func (int arr[n]);` (more) |
— | over 2 years ago |
Comment | Post #285800 |
@#53177 Maybe give it a week at least to let more people vote and give feedback? (more) |
— | over 2 years ago |
Edit | Post #285800 | Initial revision | — | over 2 years ago |
Answer | — |
A: Should we allow UI/UX questions in our community? I think it should be on-topic with the following distinction: On-topic - Technical questions regarding to UI, including mark-up language syntax, how to set properties in RAD tools, how to use graphic libraries etc. - Algorithm questions for how to draw graphics, including at some extent the math... (more) |
— | over 2 years ago |
Edit | Post #285724 | Initial revision | — | over 2 years ago |
Answer | — |
A: Why object-oriented instead of class-oriented? As with anything computer science-related that dates back to the 1960s and 70s, things just happened at a whim. Everything was new and highly experimental back then. Nobody knew how to write or design programs the best way, how to organize them or what coding styles that were most readable. The whole... (more) |
— | over 2 years ago |
Edit | Post #285716 |
Post edited: |
— | over 2 years ago |
Edit | Post #285716 |
Post edited: |
— | over 2 years ago |
Edit | Post #285716 | Initial revision | — | over 2 years ago |
Answer | — |
A: Are there references in C? Yes there are references and pass-by-reference in C, though the language has no explicit syntax item called "reference" like C++. In a C context, it is irrelevant that C++ happens to have something called references, which are basically glorified, read-only pointers. The general computer science t... (more) |
— | over 2 years ago |
Edit | Post #285715 | Initial revision | — | over 2 years ago |
Question | — |
Are there references in C? When reading posts at programming sites such as this one, I frequently encounter people saying things like: "There is no pass-by-reference in C, everything is passed by value." People claiming such tend to be of the C++ programmer variety and are used to the C++ syntax distinction between poi... (more) |
— | over 2 years ago |
Comment | Post #285575 |
@#54720 You could ask that as a separate question. (more) |
— | over 2 years ago |
Edit | Post #285575 |
Post edited: |
— | over 2 years ago |
Edit | Post #285575 |
Post edited: |
— | over 2 years ago |
Edit | Post #285575 | Initial revision | — | over 2 years ago |
Answer | — |
A: Question regarding an error message in my compiler to do with my code on linked list. To use the identifier `Node` without typing `struct Node`, you must use a `typedef`: typedef struct Node{ // this here is a stuct tag int data; struct Node next; // this has to be struct Node, refers to the above tag }Node; // but from this line and onward we can use Nod... (more) |
— | over 2 years ago |
Edit | Post #285544 | Initial revision | — | over 2 years ago |
Question | — |
How do I search for "i++"? I once wrote this post here: Why can't we mix increment operators like i++ with other operators? When using Codidact search looking for that post, I tried to type `i++` in the search but it didn't like that syntax. Then I tried `"i++"` but then the search gave no results. How should I search for t... (more) |
— | over 2 years ago |
Comment | Post #285462 |
@#54706 Essentially; if there is no rule against it people will post endless floods of copy/paste homework dumps with no effort made. This is already a massive problem at SO and they have rules against it - they even suspend people who keep posting such crap for 6 months. We should only help people w... (more) |
— | over 2 years ago |
Comment | Post #285396 |
The beginner tour: https://meta.codidact.com/tour (more) |
— | over 2 years ago |
Comment | Post #285398 |
If you intent to post in a specific group or if you know that your network contains mainly of "x" technology developers, then naturally use a post about "x". In your case maybe something about .NET? Though I'm not sure if we got many good posts about that specifically? (more) |
— | over 2 years ago |
Edit | Post #285462 |
Post edited: |
— | over 2 years ago |
Edit | Post #285462 | Initial revision | — | over 2 years ago |
Answer | — |
A: How to best ask about algorithmic problems This question was of very poor quality and should have been closed. I closed it but someone disagreed, for reasons unknown. I'm not sure if it's an actual algorithm question or just a request for free code. C strings are very specific to that programming language and I'm not sure if it's even meaning... (more) |
— | over 2 years ago |
Comment | Post #285399 |
One of the greatest benefits ought to be community-driven open source. So if we want to change something, we can. No need to scrape and bow for some non-responsive private company. (more) |
— | over 2 years ago |
Comment | Post #285351 |
I don't think this is correct - see the quote in my posted answer. Also the memory returned by malloc does not have a declared or effective type, so normal array out of bounds rules do not apply, at least not until it gets an effective type. (more) |
— | over 2 years ago |
Comment | Post #285298 |
Any variable dealing with `EOF` must be `int`, not `char`. (more) |
— | over 2 years ago |
Comment | Post #285218 |
@#54706 I don't think such an answer will be of particular high quality. This is best answered by studying the string handling chapter in a C book, then make an attempt to solve the problem and ask specific questions about the code when stuck. (more) |
— | over 2 years ago |
Comment | Post #285259 |
I now proposed to add code golf as off-topic here: https://software.codidact.com/posts/278648/285266#answer-285266 (more) |
— | over 2 years ago |
Edit | Post #285266 | Initial revision | — | over 2 years ago |
Answer | — |
A: Community feedback: What type of questions can I ask here? I propose that we add the following: > Off-topic > - Questions about code golf, programming puzzles and challenges. Please use Code Golf instead. (more) |
— | over 2 years ago |
Comment | Post #285259 |
@#54706 It's always good to have a meta thread pointing out that something is off-topic, since I just now noticed that code golf and puzzles/challenges aren't covered by our on-topic page. https://software.codidact.com/help/on-topic (more) |
— | over 2 years ago |
Comment | Post #285259 |
If one checks history, the exact data is posted. The question here was posted at 2020-08-14 but Code Golf was launched 2020-11-13. I think everyone agrees that code challenges should be posted at Code Golf and that they are off-topic here. (more) |
— | over 2 years ago |
Comment | Post #285243 |
An even worse case: since this is undefined behavior, the compiler is by no means required to generate deterministic code. Check out this example with clang for x86_64 https://godbolt.org/z/EbTGWMx93. The calling convention here is that the `esi` register must be set with the value to print. Since I... (more) |
— | over 2 years ago |
Edit | Post #285234 |
Post edited: |
— | over 2 years ago |
Edit | Post #285234 |
Post edited: |
— | over 2 years ago |
Edit | Post #285234 | Initial revision | — | over 2 years ago |