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 |
---|---|---|---|---|
Edit | Post #291960 | Initial revision | — | 11 months ago |
Answer | — |
A: Closing self-answered question due to not being clear enough A question should be closed when it cannot be meaningfully answered by someone who knows the topic. Which might indeed mean that the one(s) casting the close vote(s) would need domain knowledge. That is, it would be impossible answering it without speculating or coming up with opinions. Or the q... (more) |
— | 11 months ago |
Comment | Post #291898 |
This question is getting discussed at meta: [Closing self-answered question due to not being clear enough](https://software.codidact.com/posts/291929). (more) |
— | 11 months ago |
Edit | Post #289415 |
Post edited: |
— | 11 months ago |
Edit | Post #291855 | Initial revision | — | 11 months ago |
Answer | — |
A: Are these two function pointer declarations equivalent? Normally, whenever a function designator (a function's name) is used in an expression, it decays to a function pointer to that function. `typeof` is one of those exceptions to the "decay" rules of C (C23 6.3.2.1 §4), so if you give it a function type as operand, the result is a function type and ... (more) |
— | 11 months ago |
Edit | Post #291854 |
Post edited: |
— | 11 months ago |
Comment | Post #291854 |
What exactly is `foo`? Did you mean to use one of the previously mentioned function identifiers or did you mean `operation`? (more) |
— | 11 months ago |
Edit | Post #291853 | Initial revision | — | 11 months ago |
Answer | — |
A: Should beginner-oriented Q&A here include basic use of a terminal (command line) for developers? Shell scripts, BASH, batch files, PowerShell etc etc are all on-topic here and so questions about command line commands ought to be as well. We may however require the question to include enough relevant details like which OS, which version/distro or otherwise the question is probably off-topic. ... (more) |
— | 11 months ago |
Comment | Post #291705 |
@#78383 Not at all, probably. Dates like that (Or __STDC_VERSION__) which are existing as integer constants might be candidates to pass to a macro which performs "stringification" with `#`. If you add `'` to the constant then you would screw up the indices for finding year, month and date in that str... (more) |
— | 12 months ago |
Comment | Post #291805 |
Unless the amount of data is huge, simply copy it down to a separate buffer and let another thread take it from there? Then only the RAM copy time will lag down the GUI and not the file I/O. At which point the optimization should focus on slimming down the copy time. (more) |
— | 12 months ago |
Comment | Post #291805 |
Is there any particular use-case scenario you have in mind? Because no matter system, one way to work around file I/O bottlenecks is just to outsource it all to a separate thread. Then let that thread chew away at the files at whatever pace it likes and be done with it. In which case performance of t... (more) |
— | 12 months ago |
Comment | Post #291708 |
@#64656 Sure, there are plenty of bad programmers everywhere. Those who name identifiers in their native language or use their native language in comments are not professional - it will not get accepted in professional organizations nor during code review. The purpose of using coding standards, techn... (more) |
— | 12 months ago |
Comment | Post #291708 |
It really doesn't matter how average Joe in country x likes to write numbers. What matters is how the average _engineer_ in country x writes them. Good engineers and scientists around the world follow engineering notation and the SI system. Good engineers follow technical standards - which are public... (more) |
— | 12 months ago |
Comment | Post #291704 |
@#53078 The linked proposal N2626 offers some insights and reasoning regarding that. (more) |
— | 12 months ago |
Edit | Post #291705 | Initial revision | — | 12 months ago |
Answer | — |
A: Where to place digit separators in C23? Since this is all new, there might still be time to establish a consensus before this style feature too ends up "all over the place" (like upper/lower case hex, upper/lower case integer constant suffices etc). Luckily we can lean on established computer science in this case - there are already be... (more) |
— | 12 months ago |
Edit | Post #291704 | Initial revision | — | 12 months ago |
Question | — |
Where to place digit separators in C23? C23 introduces the digit separator `'` which can be placed anywhere inside an integer constant for the purpose of clarity and self-documenting code. These are otherwise ignored by the compiler when determining the value of the number. However, the language standard provides no guidance regarding h... (more) |
— | 12 months ago |
Comment | Post #291557 |
@#64656 The idea is to move all of that to an area for those who care to help the new user by giving polite and constructive criticism. Those who don't and just want the post gone need not bother with any of it, they can close vote the post and then it is gone for all they care. Regarding scaling, th... (more) |
— | about 1 year ago |
Comment | Post #291557 |
Some good points, I've been making these arguments too on the main meta: [Giving question feedback in private - a moderating system to reduce conflicts](https://meta.codidact.com/posts/281546) I've been in favour of removing problematic content from the public eye as quickly as possible ever since Co... (more) |
— | about 1 year ago |
Comment | Post #291540 |
Also, variables declared `static` at file scope have static storage duration too, not just those at block scope. So `static` always means static storage duration no matter the scope. (more) |
— | about 1 year ago |
Comment | Post #291540 |
_Function scope_ is a formal term in C and it explicitly refers to labels, for the purpose of `goto`. The correct term for local variables declared inside a function is _block scope_. And what you call "parameter scope" is formally called _function prototype scope_ and only applies to (prototype form... (more) |
— | about 1 year ago |
Edit | Post #285051 |
Post edited: |
— | about 1 year ago |
Comment | Post #289121 |
Just save a bookmark... On a decent browser like Firefox, you can drag bookmarks to a top panel so that they become buttons, accessible with a single mouse click or a few key strokes (Ctrl+B then type). What's the problem... (more) |
— | about 1 year ago |
Comment | Post #291479 |
If SE managed anything, it was to finally and irrevocably kill the myth "there are no bad questions". 10+ years of SE experience rather shows that "there are some questions which are not bad". And that's not really elitism or high standards: as an utter bare minimum of communication with other humans... (more) |
— | about 1 year ago |
Comment | Post #291463 |
@#82306 This is standard practice for critical systems. See for example MISRA C:2023 chapter 8.2 complete with sources and rationales - this in turn is derived from safety standards like IEC 61508 and DO-178. Now of course most code out there isn't mission-critical, but when you look at these standar... (more) |
— | about 1 year ago |
Edit | Post #291463 | Initial revision | — | about 1 year ago |
Answer | — |
A: Testing an opaque type's internals - "Black box testing" makes sense when dealing with opaque types so that's the first thing you should be doing and probably the most meaningful test too, so that's where you should put most of your efforts. But that's not what you are asking about here. - Some philosophies like TDD would encourage... (more) |
— | about 1 year ago |
Comment | Post #291460 |
typedef struct followed by the struct definition means the struct cannot be opaque because the typedef identifier is only visible to the translation unit it is located in. You have to forward declare the struct in the header and then define it using the struct tag. (more) |
— | about 1 year ago |
Comment | Post #291404 |
The correct way to solve your actual problem is most likely with proper program design. Avoid preprocessor conditionals and use inheritance instead. "Widget without foobar" is either the parent or the child of the class "Widget with foobar". One could be abstract if it makes sense, or implement an em... (more) |
— | about 1 year ago |
Edit | Post #291119 |
Post edited: |
— | about 1 year ago |
Comment | Post #291371 |
Except the application layer programmer typically won't have a clue about how the various containers are implemented internally. Which has always been a big problem with C++, `std::string` or `std::vector` silently using heap allocation etc. And if you don't know how they are implemented, you can't k... (more) |
— | about 1 year ago |
Comment | Post #291371 |
It's the same kind of argument as why computer scientists are _still_ being all smug about binary search over brute force linear iteration, even though in many situations, the latter is probably way faster on modern computers. Algorithm theory has not quite kept up with computer hardware development ... (more) |
— | about 1 year ago |
Comment | Post #291371 |
Now of course, the standard doesn't mandate how things are implemented "backstage". There's probably no good performance reason why a lot of things like `std::set` or `std::map` wouldn't be implemented as some sort of C style arrays. Namely because on most systems, arrays have superior performance fo... (more) |
— | about 1 year ago |
Comment | Post #291342 |
Hi there. As per the current scope of this site https://software.codidact.com/help/on-topic, embedded systems questions are off-topic and should be asked on https://electrical.codidact.com/ instead. But before posting there, your question should ideally be self-contained, as in don't link an entire G... (more) |
— | about 1 year ago |
Edit | Post #291342 | Question closed | — | about 1 year ago |
Comment | Post #291310 |
Some would probably disagree and saying that "pointers are dangerous". However, if the programmer can't even write correct code for iterating over a linear sequence of data, then what correct code _can_ they write... It way easier to write than to implement some manner of iteration template monstrosi... (more) |
— | about 1 year ago |
Comment | Post #291310 |
The language design mistake from there was to enforce this unison iterator interface to all classes, even those that do not benefit from it what-so-ever. That's poor OO design of the language itself - proper OO would distinct from containers which are "linear" and those who aren't. There's no reason ... (more) |
— | about 1 year ago |
Comment | Post #291310 |
"However, while writing this code, I couldn't help but notice that I am essentially writing a wrapper around pointer arithmetic." Indeed. When writing C++, one often comes to the conclusion "WTF am I even doing, this is nothing but bloated meta programming". In many cases, an `iterator` is nothing b... (more) |
— | about 1 year ago |
Edit | Post #291249 |
Post edited: |
— | about 1 year ago |
Edit | Post #291249 | Initial revision | — | about 1 year ago |
Answer | — |
A: Can I access an array element from a pointer to an object contiguous with but outside the array? The problem with undefined behavior due to array out of bounds happens whenever we use pointer arithmetic, which is only defined to work within the bounds of an array. Where plain variables, "scalars", are defined to behave just the same as arrays of 1 item, as far as pointer arithmetic is concerned.... (more) |
— | about 1 year ago |
Comment | Post #291199 |
@#78383 The header is the exposed part to the caller so you could write documentation there regarding how to tweak them. The caller shouldn't mess with the .c file. Optionally you could have the memory pool itself take these as input parameters to an init function. But most often we want the size to ... (more) |
— | about 1 year ago |
Comment | Post #281518 |
@#80520 Then you might agree with the posted answer... "memcpy is always preferred when you know the size in advance. It's always faster than strcpy. It is safe and portable." (more) |
— | about 1 year ago |
Comment | Post #291199 |
@#80468 Start with the OO design. What use-cases are there and what makes sense to turn into classes? Is "door" a central thing to your application, to the point where it needs an abstraction layer. Or do you rather benefit of having abstraction layers on a much lower level, just above the ADC or GPI... (more) |
— | about 1 year ago |
Edit | Post #291199 |
Post edited: |
— | about 1 year ago |
Comment | Post #291195 |
I know that I'm the one who lead you here, but just a note for the future that embedded systems programming questions normally goes to https://electrical.codidact.com/. But your question is all about software design and without much in the way of embedded systems aspects (save for how to allocate obj... (more) |
— | about 1 year ago |
Edit | Post #291199 | Initial revision | — | about 1 year ago |