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 Lundin‭

Type On... Excerpt Status Date
Answer A: Terms for types of functions with respect to side effects
I don't think there are any formal names for the various versions you list. First of all, please note that output in a programming context most often refers to printing something on a screen or to a file, or updating graphics. "Function output" is not a common programming term - almost every lang...
(more)
over 1 year ago
Edit Post #285910 Post edited:
over 1 year ago
Edit Post #289273 Initial revision over 1 year ago
Answer A: On self-answered questions, is it inappropriate to mark my own answer "Works for me" immediately?
On the contrary, I think that it is appropriate and recommended practice. That way you (the poster of the question) can pick your own answer as the "official" one, since these post often (ought to) take a lot of time to write. Although others are obviously also welcome to post other answers even ...
(more)
over 1 year ago
Edit Post #289043 Initial revision over 1 year ago
Answer A: To transfer, or not to, that is the question: whether 'tis nobler to let it stay or to take arms against Stack Overflow's dominance of FAQ canonicals
I would recommend to post it anew here as a self-answered Q&A and update it if needed. You can use the "works for me" reaction to label your own answer the "official" one. As an example of how this can be done, I once wrote this answer on SO. It needed some tweaks and updates, more sources added e...
(more)
over 1 year ago
Comment Post #288916 The only reason why it isn't used when it should is because the programmer is inexperienced, and that's about it. There's no disadvantages but many advantages. Private encapsulation, less namespace clutter, easier for the compiler to inline and so on.
(more)
over 1 year ago
Comment Post #283890 @#52991 Ah yeah. These were copied fragment from a complete string library. That's some function returning a `char*` or `const char*` similar to C++ `std::string::cstr`. Unfortunately this lib is proprietary so I'm already in questionable territory sharing bits and pieces of it.
(more)
over 1 year ago
Comment Post #282489 @#52991 I did write one after this. [How to do private encapsulation in C?](https://software.codidact.com/posts/283888) It covers the basics at least.
(more)
over 1 year ago
Comment Post #287301 @#52991 Yes indeed, it would be very valuable as a source to for example programming teachers, who have usually have intermediate knowledge but not to the point where they can question if a certain book is valid or not. As you can tell from the whole story in this post, I did try to get this working ...
(more)
over 1 year ago
Comment Post #285813 @#52991 A C++ reference does not pass the object to the function either. Array decay only makes arrays equivalent to pointers in the first dimension, `int arr[n]` decays to `int*`. But that is not true for `int arr[x][y]` which decays to `int (*arr)[y]`, which is pretty much 100% equivalent to a C++ ...
(more)
over 1 year ago
Comment Post #288845 Ok seems that you might be able to answer your own question then :) Which is fine - it is encouraged to post answers to your own questions if you found it yourself.
(more)
over 1 year ago
Comment Post #288845 Have you checked with the various companies that specialize in CAN tools and software? IXXAT, Kvaser, Vector etc. If not then what's the requirements, does it have to be open source? Any particular language(s)?
(more)
over 1 year ago
Comment Post #288768 @#53890 That would just be weird. I don't really see any application for it, on meta or elsewhere.
(more)
over 1 year ago
Edit Post #288768 Initial revision almost 2 years ago
Answer A: Should posting on Meta affect reputation?
Codidact has already managed somewhat to separate domain knowledge from moderator suitability. So far so good, but reputation is also a measurement of activity. It might make sense that being active on meta should be rewarded somehow, just as being active on the main site is rewarded over time. ...
(more)
almost 2 years ago
Comment Post #288576 Maybe we could draw the line of what's considered programming at VBA? VBA essentially being an integrated programming language. Sure you can do lots of programming-like things with excel formulas, but it is as clunky as can be...
(more)
almost 2 years ago
Comment Post #288304 @#61308 Regarding "debug" tag, I don't think that won't work... teaching new users how to use tags correctly always was mission impossible. A debug category might work though, given that regular/trusted users can move posts between categories somewhat effortlessly, without having to call for a modera...
(more)
almost 2 years ago
Comment Post #288304 @#61308 When closing something as duplicate and it isn't obvious how the link solves the problem, at least I think it's appropriate to explain why in comments. Although this is much easier to do when you have a "dupe hammer" and can close posts unanimously. In case there are multiple problems, you ca...
(more)
almost 2 years ago
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)
almost 2 years ago
Edit Post #288333 Initial revision almost 2 years 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)
almost 2 years 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)
almost 2 years 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)
almost 2 years 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)
almost 2 years 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)
almost 2 years ago
Edit Post #288254 Post edited:
almost 2 years ago
Comment Post #288254 @#61030 Ah yeah the example I made is plain wrong. I'll remove it.
(more)
almost 2 years ago
Edit Post #288254 Post edited:
almost 2 years ago
Edit Post #288254 Initial revision almost 2 years 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)
almost 2 years 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)
almost 2 years 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)
almost 2 years 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)
almost 2 years ago
Edit Post #285051 Post edited:
almost 2 years 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)
almost 2 years 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)
almost 2 years 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)
almost 2 years ago
Edit Post #288020 Initial revision almost 2 years 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)
almost 2 years 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 2 years 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 2 years 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 2 years ago
Edit Post #287917 Post edited:
about 2 years ago
Edit Post #287917 Post edited:
about 2 years 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 2 years ago
Edit Post #287917 Initial revision about 2 years 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 2 years 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)
about 2 years ago
Edit Post #287827 Initial revision about 2 years ago