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 Indi
| Type | On... | Excerpt | Status | Date |
|---|---|---|---|---|
| Comment | Post #296588 |
@#53937 It is *all* indeterminate values. See Annex J.2 (11), to start. That point focuses specifically on indeterminate values in automatic variables, but there are other parts that mention indeterminate values in allocated variables (185, 186), and there’s plenty of other evidence scattered aro... (more) |
— | 10 days ago |
| Comment | Post #296632 |
Yes, wrapping a C library is not worth it if you’re just using it once, and the project is relatively small. For those cases, what you’re doing—just wrapping the resource management stuff in smart pointers—is exactly the right thing to do.
If you are using the C library a lot, or it’s a more c... (more) |
— | 11 days ago |
| Edit | Post #296632 | Initial revision | — | 12 days ago |
| Answer | — |
A: Smart pointer with custom deleter with 'using pointer = <pointer type>' Your understanding is correct: if the deleter has a member type `pointer`, then `std::uniqueptr` uses that to define its own member type `pointer`, and from that, most other operations. So long as you don’t do anything too complicated, it should “work”. Since you only seem to be doing sets and ge... (more) |
— | 12 days ago |
| Comment | Post #296588 |
> "If a pointer value is used in an evaluation after the object the pointer points to (or just past) reaches the end of its lifetime, the behavior is undefined." This means the same thing essentially, it refers to de-referencing a pointer…
The value of a pointer is the address (6.2.5.p25.5), n... (more) |
— | 12 days ago |
| Edit | Post #296588 |
Post edited: |
— | 12 days ago |
| Comment | Post #296600 |
What makes your position particularly silly, though, is that *Stroustrup advocates AGAINST using those kinds of `for` loops*. Virtually the entirety of his corpus is advocating instead for the use of algorithms… or *at least* range-`for`… neither of which really benefit all that much from `auto`.... (more) |
— | 12 days ago |
| Comment | Post #296600 |
Again… and this is a repeated theme… you are just not reading things through carefully.
That Stroustrup FAQ isn’t explaining the history of `auto`’s standardization, it is explaining what the feature *is*. It’s a FAQ on C++11 features, not a history of its standardization. It’s explaining how ... (more) |
— | 12 days ago |
| Comment | Post #296600 |
> Similarly, lambdas didn't exist either. You seem overall very confused about the order when things were added to the C++ language.
Again, **read the answer**. Don’t skim it. **Read** it. And if you don’t have the time or patience to read it, then please refrain from critiquing it. Because re... (more) |
— | 12 days ago |
| Comment | Post #296600 |
> No you couldn't, that feature wasn't around in C++03.
Yes, you could, because that feature *was* around in C++03. It wasn’t spelled that way, but that’s irrelevant to the point I was making. I wasn’t saying “you could use `using` in C++03”, I was (rather explicitly) saying that if the main c... (more) |
— | 12 days ago |
| Comment | Post #296600 |
This is obviously a topic you are very emotionally attached to, for whatever reason, but if you are going to critique an answer, you should really read it properly, and not just skim it looking for things to snap at. All of your objections demonstrate either a lack of comprehension about the cont... (more) |
— | 12 days ago |
| Edit | Post #296588 |
Post edited: |
— | 16 days ago |
| Edit | Post #296600 | Initial revision | — | 21 days ago |
| Answer | — |
A: Why is the new auto keyword from C++11 or C23 dangerous? I am not going to answer the topic question directly, because I find it rather disingenuous. It’s not just leading; it seems to already have a conclusion in mind. I am also not going to consider the C side of things. While I don’t really see the logic in being fanatical about knowing the types i... (more) |
— | 21 days ago |
| Comment | Post #296588 |
That is definitely UB. The rationale: Reading an indeterminate value is always UB. Casting an indeterminate value from type to another does not make it any less indeterminate. You’re still reading an indeterminate value… you’re just now reading it as an indeterminate integer value, rather than in... (more) |
— | 25 days ago |
| Edit | Post #296588 |
Post edited: |
— | 25 days ago |
| Edit | Post #296588 | Initial revision | — | 25 days ago |
| Answer | — |
A: Is it UB to read value of heap pointer after freeing? EDIT 3: So the C standard example is now apparently being misinterpreted. Guess I’ll have to explain it. EDIT 2: So I’ve been asked to provide sources for my answer. Fair enough. To recap, my answer is: 1. A pointer to an object becomes indeterminate when that object’s lifetime ends. 2. Acces... (more) |
— | 25 days ago |
| Edit | Post #296574 | Initial revision | — | 28 days ago |
| Answer | — |
A: Post length limit for Code Reviews questions and answers The consensus in the answers so far is that 640 kiB ought to be enough for anyone any code review request longer than 30,000 characters is not “focused”—or not “properly scoped” or not “constructive”. I’ve been doing (volunteer, open-source) code reviews for the better part of a decade now, and m... (more) |
— | 28 days ago |
| Edit | Post #296548 | Initial revision | — | about 1 month ago |
| Answer | — |
A: Parallel execution with algorithms and execution policies I can’t comment on mavieth’s answer, but I think their conclusion is correct; the libstdc++ `std` module doesn’t use the oneTBB backend. It seems like the problem is that oneTBB, when included as headers, injects translation-unit-local stuff into the module purview… which is not allowed. oneTBB... (more) |
— | about 1 month ago |
| Comment | Post #296523 |
I believe I said that, quote, global state “among other things” would cause the same problems. That other things might also cause those problems does not change the fact that globals cause them. (more) |
— | about 1 month ago |
| Edit | Post #296523 | Initial revision | — | about 1 month ago |
| Answer | — |
A: Why is global evil? Another reason that, sadly, very rarely gets mentioned is testing. Global variables make testing hard, and in some cases, functionally impossible. Any time a logical code entity—whether a class, a function, a module, whatever—is self-contained, it can be tested in isolation. The tests will also ... (more) |
— | about 1 month ago |
| Edit | Post #296500 | Initial revision | — | about 1 month ago |
| Question | — |
Makefile for auto-generating dependencies in module-based C++ projects C++20 modules are awesome, and the `std` module introduced in C++23 makes them even more awesome. Unfortunately, tooling has been slow to catch up to the promise. Heavy duty build systems like build2 and CMake do support building module-based projects, but for simple experimentation, they can be... (more) |
— | about 1 month ago |
| Edit | Post #296474 | Initial revision | — | about 1 month ago |
| Answer | — |
A: Any testimonials for any C++ units of measure library? Look into mp-units. Here is what code that does what the question mentions looks like: ```c++ #include // or import std; #include // or import mpunits; auto main() -> int { using namespace mpunits::si::unitsymbols; constexpr auto v1 = 2 km; constexpr auto v2 = 3 m; std::... (more) |
— | about 1 month ago |
