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 dmckee
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Comment | Post #282925 |
I’m not familiar with the expression “compound variable”. Logic suggests it may apply to a programming artifact with multiple named fields (as a struct in c or a record in pascal) or a possibly heterogeneous ordered structure (like a list s-expr or a python tuple), but it might help if you could give... (more) |
— | almost 3 years ago |
Comment | Post #282691 |
Is that better? If not feel free to suggest something you like better. (more) |
— | almost 3 years ago |
Comment | Post #281520 |
Smart pointers *solve* the lifetime problem. In cases where the sending code is done with the data you use a `std::unique_ptr` to transfer ownership. If for some reason the sending code needs to retain access you use a `std::shared_ptr` which has more overhead but will be at least as efficient as any... (more) |
— | almost 3 years ago |
Comment | Post #281520 |
Also potentially useful: try to reduce unneeded copies. Don’t pass large objects, pass suitable smart pointers to them. (more) |
— | about 3 years ago |
Comment | Post #281496 |
@ArtOfCode By way of potentially helpful information, I received two comment notifications (maybe one for your test comment?) associated with my answer, but saw no comments. (more) |
— | about 3 years ago |
Comment | Post #281486 |
How you respond to the load problem depends on where the Qt signals/slots solution is being too slow. If the signals queue is the issue the you can keep using QFile/QTextSteam, but if those classes are the bottleneck you may have to go to a low-level IO solution. (more) |
— | about 3 years ago |
Comment | Post #281486 |
Strangely I got notifications for the comments you didn’t manage to actually post. Probably a bug in the engine. (more) |
— | about 3 years ago |
Comment | Post #281474 |
The pointer hack is cute, but to prevent an unintended change in semantics you might pass pointer to const. Of course you'll need a copy if your implementation is changing the passed arguments but you won't inadvertently change values for the calling code. (more) |
— | about 3 years ago |
Comment | Post #281081 |
In that case [Peter is on the right track](https://software.codidact.com/posts/281095#answer-281095). (more) |
— | about 3 years ago |
Comment | Post #281081 |
It might help to say what you are considering under the label “secure” here. Do you *trust* the scripts? (more) |
— | about 3 years ago |
Comment | Post #280640 |
Anyone one who regularly crosses the line between c and c++ should keep in mind that c++’s strict aliasing rule is stricter than c’s. Punning in-place is possible a couple of ways in c and essentially forbidden in c++. Drives me bats because the committee *could* have made an exception for POD types,... (more) |
— | about 3 years ago |
Comment | Post #279879 |
I work with a project (something my work depends on and is not available through the usual high level distribution mechanisms) that uses this scheme and it works, but it feels as hoc. Why do I need a script to invoke the meta-build system? To get both production and debug I end up using two scripts. (more) |
— | about 3 years ago |
Comment | Post #280536 |
It *should* get rid of the switches, but I started using that nonsense because MSVC *was* warning me about unfamiliar #pragma’s. (more) |
— | over 3 years ago |
Comment | Post #280536 |
Every time I think I know this language someone comes along and shows me another corner I've never heard of. Thanks. (more) |
— | over 3 years ago |
Comment | Post #280528 |
@Lundin Using `memcmp` changes the semantics (NaNs can compare equal...) so you need to think about what you intend. We actually have a namespace where we define various classes of floating point comparisons (and use the abhorrent mess above in the implementation for `fp::exactlyEqual`) so that the c... (more) |
— | over 3 years ago |
Comment | Post #280217 |
I’d add that the only way to know what kinds of effects language selection can have is to do some projects with varied languages. Don’t do those experiments on projects that others are counting on, so *do* try out new languages for smallish (but non-trivial) hobby projects. (more) |
— | over 3 years ago |
Comment | Post #279021 |
@Canina These are exactly the reasons I don't push hard to get to that simple structure. That said, I imagine that if we hunted down a "clean code" evangelist and offered them a coffee to discuss this they'd tell us we need to use more and more carefully chosen abstractions so the state that looks s... (more) |
— | over 3 years ago |
Comment | Post #279863 |
If anything a beginners reaction (at least one as thoughtful as this) is an advantage because any code I produce along this line in likely to be read by juniors with limited exposure from time to time. For what it's worth, I encountered #1 first but am leaning more and more towards using `static_asse... (more) |
— | over 3 years ago |
Comment | Post #278924 |
@anatolyg That's all well and good if c++20 is an option for you; the project that prompted this question is for work and the customer's requirements effectively lock us in to c++11. Indeed, due to customer requirements my whole shop is running 5+ years behind the standard (we're just starting to dis... (more) |
— | over 3 years ago |
Comment | Post #279013 |
@Lundin Well, the containers and algorithms template code has certainly been folded in with the rest of the standard library. On SomeplaceElse I read that tag as *"I want to ask about the templated parts of the standard library and not just about c++ features in the raw"*, which I consider to be usef... (more) |
— | over 3 years ago |
Comment | Post #279013 |
@Moshi Yeah. That's better. (more) |
— | over 3 years ago |
Comment | Post #279013 |
Am I to take it that people don’t care for my (allegedly funny) title, or do people really think this ambiguity is OK? (more) |
— | over 3 years ago |
Comment | Post #278988 |
This. But if we wanted a “don’t add the parent tags” ethos locally we could compensate with a do/don’t include child tags options when registering a favorited tag. (more) |
— | over 3 years ago |
Comment | Post #278924 |
@jrh The sample code is made up for this post. I used `is_floating_point` because I can spell it without a search (I really don't use this stuff much). Where it appears in my project there is a cascade of SFINAE tests that cover quite a few classes of possible inputs (floating point, other numeric, s... (more) |
— | over 3 years ago |
Comment | Post #278924 |
@jrh I wouldn't call it controversial at all. Doing anything sophisticated with templates results in code that is hard to read, harder to debug, and simply brutal on edit-compile-test cycle times. We don't reach for this stuff first and we've got it in less than 1% of our headers (and plain template ... (more) |
— | over 3 years ago |
Comment | Post #278846 |
While I largely agree that all bash (or other shell) features are candidates for programming questions, the emphasis of programming answers to bash questions may be a bit different from the emphasis of using-the-CLI answers. You'd need a working consensus to maintain culture that prefers the former t... (more) |
— | over 3 years ago |
Comment | Post #278924 |
@Lundin The flip side of KISS is [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself). Restricting the type-generic interface does make sense for things like writing a specialized STL-like algorithm that only works on random access containers. In principle you could accomplish that with polym... (more) |
— | over 3 years ago |
Comment | Post #278606 |
I'm actually quite interested in this question for myself. We're using Doxygen for the rest of our code, but we don't have any tooling for the DB beyond a schemacrawler script that generates a PDF schema diagram. Notes about how a table is intended to be used are written in un-formatted comments, but... (more) |
— | over 3 years ago |
Comment | Post #278202 |
I'm fairly sure the term existed at least as early as the eighties. (more) |
— | over 3 years ago |
Comment | Post #277882 |
I'd go further than calling the new syntax an "alternative". I wouldn't use the `SIGNAL` and `SLOT` macros in new code. Indeed, unless I was still trying to support Qt4 I wouldn't write new instances of the macros even in a legacy code base. (more) |
— | over 3 years ago |