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: 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 an object that is not an element of an array behaves the same as a pointer to the first element of a... (more) |
— | over 2 years ago |
Edit | Post #285218 | Question closed | — | over 2 years ago |
Comment | Post #285218 |
I started to write a pseudo-code answer but the question is simply too broad. You need to use `strstr`, you need to use `strcpy`, you need to write a loop. Explaining how to do these things in detail is the task of the string handling chapter in your C book. I voted to close it as "too generic", plea... (more) |
— | over 2 years ago |
Comment | Post #285169 |
@#53410 It's not trivial to get 100k+ rep and a C gold badge at SO. Also it's people I've interacted with for many years and I know how good they are at C programming. Unlike random people in the average open-source project, who tend to range between mediocre and average. As for "wildly used", that c... (more) |
— | over 2 years ago |
Comment | Post #285169 |
@#53410 You aren't going to prove anything by linking random open source libraries by random people - only by providing the take from well-known C gurus. Now as it happens on SO we have some 20-30 of such very skilled C programmers pretty much unanimously agreeing that hiding pointers behind typedefs... (more) |
— | over 2 years ago |
Comment | Post #285169 |
@#53410 I'd say that the vast majority of C programmers find it bad practice. You can for example check out all the close to unanimous criticism regarding how bad the Windows API type system was designed, where the main arguments against it was its use of "Hungarian notation" and pointers hidden behi... (more) |
— | over 2 years ago |
Comment | Post #285169 |
Hiding pointers behind typedef is considered very bad practice. If you got that from a book, it's not a good book. The actual parameters here are `struct listNode **sPtr` which explains why the pointed-at address can be modified - to for example point at space obtained by a `malloc` call inside the f... (more) |
— | over 2 years ago |
Comment | Post #285177 |
Please edit the post and fix the code formatting - you have non-existent indention. (more) |
— | over 2 years ago |
Comment | Post #285148 |
Unless the strings contain any exotic characters beyond Latin English (7 bit ASCII), just type it as you would in any text editor. (more) |
— | over 2 years ago |
Comment | Post #285136 |
@#54710 Some versions of Codeblocks include old gcc/mingw versions before version 5.0.0. Those default to gnu90 and not to a modern C standard - they would exhibit this very bug about missing include that I mention. If you follow the advise in the link I gave, you should be able to use fairly old gcc... (more) |
— | over 2 years ago |
Edit | Post #285135 |
Post edited: More relevant tags |
— | over 2 years ago |
Edit | Post #285136 | Initial revision | — | over 2 years ago |
Answer | — |
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 compiler and it can't find `fopen` - because you did forget to `#include `. When this happens on mo... (more) |
— | over 2 years ago |
Edit | Post #285120 | Initial revision | — | over 2 years ago |
Answer | — |
A: What does the greater than 0 indicate in the case of this statement 'if (compare(A[j], A[j+1]) > 0)' ? Thank you. Generally speaking, comparison callback functions in C are often implemented to return an integer lesser than zero, equal to zero or greater than zero - depending on if the first object is lesser than, equal to or greater than the second object. How it is done in your case, there's no telling sinc... (more) |
— | over 2 years ago |
Edit | Post #285051 |
Post edited: |
— | over 2 years ago |
Edit | Post #285051 |
Post edited: |
— | over 2 years ago |
Edit | Post #285051 |
Post edited: |
— | over 2 years ago |
Edit | Post #285051 |
Post edited: |
— | over 2 years ago |
Edit | Post #285051 | Initial revision | — | over 2 years ago |
Answer | — |
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 long it will be valid. Other examples of storage class specifiers are `extern` and `register`. It s... (more) |
— | over 2 years ago |
Edit | Post #285050 | Initial revision | — | over 2 years ago |
Question | — |
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: ```c #include static int x = 5; int main (void) { printf("%d\n", x); } ``` 2) As a variable inside a function: ```c void func (void) { s... (more) |
— | over 2 years ago |
Comment | Post #285035 |
We had this very discussion before here: [Growing software.codidact](https://software.codidact.com/posts/278910). We didn't have the ability to do advertising then though, so maybe it isn't a duplicate. (more) |
— | over 2 years ago |
Edit | Post #284979 | Initial revision | — | over 2 years ago |
Question | — |
Questions easily answered by studying a beginner-level book This scenario is not yet a problem for this site, but we will get there, since it's a huge problem for Stack Overflow: Someone just picks up a well-known programming language for the first time. Then they almost immediately post a question on an online programming forum, which they could have easi... (more) |
— | over 2 years ago |
Comment | Post #284806 |
I know nothing of Python but this sounds like a perfect case for multi-threaded execution in parallel. Split up the 300,000 tasks over a number of threads in charge of calculating their part of the total work. (more) |
— | over 2 years ago |
Comment | Post #284849 |
@#53185 No, but unfortunately some mainstream compilers like the gcc-like ones are not set to strictly conforming C by default. Hence the provided link below bug 1, which instructs how to configure the compiler correctly to prevent the compiler from generating an executable when given non-conforming ... (more) |
— | over 2 years ago |
Edit | Post #284850 |
Post edited: |
— | over 2 years ago |
Edit | Post #284850 | Initial revision | — | over 2 years ago |
Answer | — |
A: Common string handling pitfalls in C programming The reader is assumed to understand how arrays and pointers work in C. You cannot understand pointers before you understand arrays, and you cannot understand strings before you understand pointers and arrays both. Decent C books therefore teaches arrays, then pointers, then strings, in that order. ... (more) |
— | over 2 years ago |
Edit | Post #284849 | Initial revision | — | over 2 years ago |
Question | — |
Common string handling pitfalls in C programming Preface: This is a self-answered Q&A meant as a C string handling FAQ. It will ask several question at once which isn't ideal, but they are all closely related and I'd rather not fragment the post into several. When reading C programming forums or code written by beginners, there is a number o... (more) |
— | over 2 years ago |
Edit | Post #284571 | Initial revision | — | over 2 years ago |
Answer | — |
A: Are general questions (hopefully resulting in comprehensive, 'canonical' answers) in scope Generally these questions are fine, though they should come with specific examples, so that they become clearer and can get narrowed-down. I've done a lot of self-answered Q&A here and the hardest part is often to ask a sensible question. - Overly broad questions like "what is OOP?" isn't likely t... (more) |
— | over 2 years ago |
Comment | Post #284552 |
I suspect that what Alexei is trying to create here is a canonical meta post that we can use as reference for all meta questions of the "why did I get a down vote" flavour. Since such meta questions are both tedious and subjective (and cannot really be answered), they could be closed as duplicate to ... (more) |
— | over 2 years ago |
Comment | Post #284510 |
As for the technical content, why would you do this with multiple processes and IPC (pipes) instead of multithreading? (more) |
— | over 2 years ago |
Comment | Post #284510 |
@#53734 There's no beef as such with Stack Overflow, if that's what you refer to (references like "Somewhere Else" etc are mostly tongue-in-cheek). It's perfectly fine to refer to it (and import your content from there to here). Codidact simply strives to be something else: community-driven open-sour... (more) |
— | over 2 years ago |
Edit | Post #284481 |
Post edited: This is C++ code, not C. |
— | over 2 years ago |
Comment | Post #284413 |
This is some random library made by some random person and the link is dead. So unless you have the files on your harddrive, you can't use the lib. (more) |
— | over 2 years ago |
Edit | Post #284402 |
Post edited: |
— | over 2 years ago |
Edit | Post #284402 |
Post edited: |
— | over 2 years ago |
Edit | Post #284402 |
Post edited: |
— | over 2 years ago |
Edit | Post #284402 | Initial revision | — | over 2 years ago |
Answer | — |
A: Should we allow questions about installation and configuration of software development tools? Generally, I would say: On-topic - How to install, configure, trouble-shoot and use tools specifically meant for software development. Compilers, debuggers, IDEs and so on. - Asking questions regarding the above in good faith, as in assuming your problem is related to the specific programmer t... (more) |
— | over 2 years ago |
Comment | Post #282566 |
@#53249 The context of this post is how beginners should compile their programs. They should most definitely not be compiling code that old. In case of professionals, we all have our cross to bear in the form of maintaining old, bade code. I'm still maintaining some (naive) old code written by myself... (more) |
— | over 2 years ago |
Edit | Post #284355 |
Post edited: Making personal tags which is used by your own code base only has no value to anyone else. If/when your library is used by thousands of people, that's another story... |
— | over 2 years ago |
Edit | Post #282565 |
Post edited: |
— | over 2 years ago |
Edit | Post #284192 |
Post edited: |
— | over 2 years ago |
Edit | Post #284192 | Initial revision | — | over 2 years ago |