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 |
---|---|---|---|---|
Comment | Post #288330 |
In fact repeated, seemingly localized trouble-shooting posts can act as an "aha experience" to locate FAQs beyond the most obvious and common ones. Something that you don't realize is a FAQ before you read _a lot_ of posts over time and start to recall "hey didn't I answer this some year back". And t... (more) |
— | 11 months ago |
Edit | Post #288333 | Initial revision | — | 11 months ago |
Answer | — |
A: How are software recommendations handled? See Software recommendations category. Referring to my own answer there, I think these questions should only be on-topic in case the OP manages to narrow down the scope sufficiently. In case the question contains some sort of use-case/usage scenario and important requirements, it should be OK - other... (more) |
— | 11 months ago |
Comment | Post #288321 |
Adding a separate category was discussed before here: [Software recommendations category](https://software.codidact.com/posts/285969/285971). Nobody came up with much in the way of arguments in favour for creating a new category. (more) |
— | 11 months ago |
Comment | Post #288330 |
Great answers both answer the localized problem and put it in a wider context. For example by mentioning good and bad practices - how the problem was caused by not following these. Or by dissecting some cryptic compiler message that the OP didn't understand and explain why this particular message app... (more) |
— | 11 months ago |
Comment | Post #288304 |
The problem that you aren't seeing is duplicates. If some 90% of the site content are questions that have been asked before, they drown out everything else. To the point where the person who isn't asking a FAQ gets reduced chances of getting an answer, because everyone is busy dealing with the flood ... (more) |
— | 11 months ago |
Comment | Post #288282 |
Codidact isn't like SO where you automatically unlock privileges when reaching a certain reputation threshold. Rather, domain knowledge and moderator suitability should be kept separate. I'm not sure of the exact mechanics, though check out https://meta.codidact.com/posts/278536 and the help files: h... (more) |
— | 11 months ago |
Edit | Post #288254 |
Post edited: |
— | 11 months ago |
Comment | Post #288254 |
@#61030 Ah yeah the example I made is plain wrong. I'll remove it. (more) |
— | 11 months ago |
Edit | Post #288254 |
Post edited: |
— | 11 months ago |
Edit | Post #288254 | Initial revision | — | 11 months ago |
Answer | — |
A: Storing more bytes than a union member has, but less than the union size, with memcpy(3) `memcpy(&y.t, &x, sizeof(x));` is a bit fishy since it would have made more sense to copy into `&y` or `&y.s`. None of this is necessarily UB however. Regarding strict aliasing, it doesn't really matter. If you allocate with a `malloc`-like function then the data has no declared type and effective... (more) |
— | 11 months ago |
Comment | Post #288198 |
If you'd like to copy/paste this as an answer to [Should we have a network-wide policy against AI-generated answers?](https://meta.codidact.com/posts/287896) then I think it answers that question too. (more) |
— | 11 months ago |
Comment | Post #285051 |
@#53937 Something evil like this should be possible: `static const size_t zero = 0;`... `void func (int x[zero])`. Or maybe even `void func (int x[ (int){0} ])`. I have no idea why the mainstream compilers allow that, but it seems like they do. (more) |
— | 11 months ago |
Comment | Post #285051 |
@#53937 static in the array parameter context refers to what the parameter points at, so it actually does make sense since we can't have zero-sized arrays in C. `int end[0]` is equally invalid, that's a gcc extension. And the only reason why gcc ever supported zero-sized arrays is historical - they u... (more) |
— | 11 months ago |
Edit | Post #285051 |
Post edited: |
— | 12 months ago |
Comment | Post #288023 |
Re-inventing the C language by replacing it with your private macro language is a cardinal sin. Yes, a whole lot of standard lib functions have horrible APIs, but other C programmers supposedly know about those quirks. They don't know how your secret macro language works however, and will be really p... (more) |
— | about 1 year ago |
Comment | Post #288020 |
@#53937 As for C23 (the latest draft is N3088) the accepted proposal/DR is just the usual incoherence from the Committee about indeterminate values. There's no making sense of it all without any proper explanation. Does trap representations exist in the C language or not? In which situations do inter... (more) |
— | about 1 year ago |
Comment | Post #288020 |
@#53937 The compiler isn't allowed to insert side effects in a program which isn't there in the source. `free()` has no side effects related to the passed pointer variable, only related to what it points at. It's kind of a C design flaw that `free()` doesn't take a pointer to pointer as parameter. Th... (more) |
— | about 1 year ago |
Edit | Post #288020 | Initial revision | — | about 1 year ago |
Answer | — |
A: Can freed pointers undergo lvalue conversion? `p` is assigned a value and then it becomes indeterminate when the pointed at object has reached the end of its lifetime (C17 6.2.4). Pointers may have trap representations (C17 6.2.6.1/5) and in case the indeterminate value matches a trap representation, the assignment `q = p;` invokes undefined... (more) |
— | about 1 year ago |
Comment | Post #287917 |
@#53937 Only in case pointers have trap representations. Although... in case someone is curious, because of this very example, I managed to kill the clang 15 compiler's conformance in horrible ways. [clang 15 miscompiles code accessing indeterminate values](https://stackoverflow.com/questions/7553369... (more) |
— | about 1 year ago |
Comment | Post #287917 |
Btw how `memcmp` is implemented internally isn't relevant since that implementation in itself need not be done in C or be conforming C - it is a standard library function. For example it could be implemented in assembler. (more) |
— | about 1 year ago |
Comment | Post #287917 |
@#53937 Yes, from C17 6.2.4: "The value of a pointer becomes indeterminate when the object it points to (or just past) reaches the end of its lifetime." In case of allocated storage, this happens when you call `free()`. For example `int* ptr = original; free(original); if(ptr == original)` is not _r... (more) |
— | about 1 year ago |
Edit | Post #287917 |
Post edited: |
— | about 1 year ago |
Edit | Post #287917 |
Post edited: |
— | about 1 year ago |
Comment | Post #287908 |
The crux here is that an optimizing compiler can completely omit the `memcmp` call in the first place. Since the value of the passed object holds an indeterminate value, the compiler is free to replace the whole `memcmp` call with anything like `1` or `0`. It doesn't actually have to execute the func... (more) |
— | about 1 year ago |
Edit | Post #287917 | Initial revision | — | about 1 year ago |
Answer | — |
A: memcmp(3) memory containing invalid values Regarding undefined behavior/uninitialized variables of automatic storage duration First of all there's some misconceptions here. `if (x == 0)` is UB only because `x` was declared as a local variable (automatic storage) without having its address taken - "could have been declared as `register`"... (more) |
— | about 1 year ago |
Comment | Post #287842 |
In case of embedded systems: it goes like "do not needlessly connect it to the Internet in the first place". https://www.wired.com/2015/07/hackers-remotely-kill-jeep-highway/ (more) |
— | over 1 year ago |
Edit | Post #287827 | Initial revision | — | over 1 year ago |
Answer | — |
A: Should we allow answers generated by ChatGPT? After some more experience from this bot over a couple of months, I would say that we should ban it simply because: The answers it gives are often wrong. ChatGPT has been hyped up ridiculously. It is not that good, it is not that smart, it cannot be trusted to give correct answers to complex to... (more) |
— | over 1 year ago |
Edit | Post #287123 |
Post edited: |
— | over 1 year ago |
Comment | Post #287760 |
@#53937 No that's really the same thing. Structs and arrays mostly follow the same rules in this case (being "aggregates" as far as the effective type rules are concerned). (more) |
— | over 1 year ago |
Edit | Post #287760 | Initial revision | — | over 1 year ago |
Answer | — |
A: Is partial allocation of an object Undefined Behavior? Since I don't think the C standard says anything explicitly about cases like this, it is probably undefined behavior, under the "not mentioned in the standard" variety. If something isn't mentioned, it is per definition undefined and not well-defined. The closest thing might be the somewhat unclea... (more) |
— | over 1 year ago |
Edit | Post #287748 |
Post edited: Typo |
— | over 1 year ago |
Edit | Post #287750 | Initial revision | — | over 1 year ago |
Answer | — |
A: Strict aliasing rules and function boundaries Assuming that there are no alignment problems between the two pointer types (impl-defined), the code is otherwise well-defined. As per the quoted 6.3.2.3 C allows pretty much any form of wild and crazy pointer conversions by means of a cast, as long as you don't actually de-reference the pointer thro... (more) |
— | over 1 year ago |
Comment | Post #287607 |
Are Java and C# `interface` common enough to justify using the same tag? Otherwise maybe two tags java-interface and C#-interface would solve the problem. I see no purpose of the tag outside these specific language keywords. (more) |
— | over 1 year ago |
Comment | Post #285727 |
I'd say that the "three pillars" are private encapsulation, autonomous objects and inheritance. Autonomous objects meaning that each object just does it's own designated task and doesn't meddle with other unrelated things - it has _loose coupling_, as few dependencies on other things in the program a... (more) |
— | over 1 year ago |
Comment | Post #287561 |
Just ask the same question here. What answer you got elsewhere and from whom is irrelevant. (more) |
— | over 1 year ago |
Edit | Post #287504 | Initial revision | — | over 1 year ago |
Answer | — |
A: Are questions about language design on-topic? The ambition of this site was always to give more room for subjective and big picture questions compared with Someplace Else. However, I believe programming language design falls under the topic of general computer science. It doesn't match anything in the current on-topic list. General computing... (more) |
— | over 1 year ago |
Comment | Post #287454 |
Great job everyone who was involved in finally fixing this! (more) |
— | over 1 year ago |
Comment | Post #287301 |
The problem with "non-authoritative" recommendations is that they become completely subjective. If some random person with random experience likes a certain book, then that doesn't tell us anything more than a random subjective review on Amazon - it all turns low quality and unlikely to be of actual ... (more) |
— | over 1 year ago |
Edit | Post #287123 |
Post edited: |
— | over 1 year ago |
Comment | Post #287137 |
A quality list goes beyond "I have read it and it was good" though, because everyone can read a book and share an opinion of it. You can then get a recommendation about how easy to read and pedagogic the books was (similar to Amazon reviews perhaps). But not a measurement of technical correctness. So... (more) |
— | over 1 year ago |
Edit | Post #287123 | Initial revision | — | over 1 year ago |
Answer | — |
A: Should asking about book recommendations directly connected to software development be on-topic? As someone who spent a lot of time trying to get this to work on Stack Overflow, I would advise against it. Some background story of my merry adventures with book lists: The story starts around here: Delete the list of random books? Back in 2015 I stumbled upon a list of random books not n... (more) |
— | over 1 year ago |