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 #281308 | Question closed | — | about 4 years ago |
Comment | Post #281308 |
It would be fine to ask this on meta. But currently, "asking to explain what a certain code does, unless they are small and an attempt to understand them is also added" is listed as off-topic for this site. https://software.codidact.com/help/on-topic. The meta discussion thread can be found here: htt... (more) |
— | about 4 years ago |
Comment | Post #279578 |
@Incnis Mrsi Well it depends on if the braces would surround both gotos or just one. It wouldn't have passed manual code review either. If they had any resemblance of a quality coding standards, then none of the code from that link would be allowed. Not just the brace issue, but goto itself, assignm... (more) |
— | about 4 years ago |
Comment | Post #277488 |
@Incnis Mrsi It means either 2's complement, 1's complement or signed magnitude. C unfortunately allows all of these still. In practice, the vast majority of all real-world computers use 2's complement. (more) |
— | about 4 years ago |
Comment | Post #281020 |
@Estela There's a place for macros and even function-like macros, but not in this specific case. Avoid them when you can. (more) |
— | about 4 years ago |
Comment | Post #280999 |
So as I see it there are 3 options: 1) either we'd create a "Beginner" category and make it default. 2) Or we turn the current "Q&A" into the beginner-friendly one and create an "Advanced" category (the name and scope would have to be debated separately). 3) Or we outlaw beginner questions, in which ... (more) |
— | about 4 years ago |
Comment | Post #280999 |
We've discussed this to-and-fro since the early stages of Codidact, for example [here](https://forum.codidact.org/t/how-to-treat-debugging-and-easy-to-google-and-very-basic-questions/1122/3). A separate category was proposed then too. And as indicated in that discussion (by experience from SO), such ... (more) |
— | about 4 years ago |
Comment | Post #278896 |
@Ayxan Haqverdili I'll try to replace it with another, please try again now. (more) |
— | about 4 years ago |
Edit | Post #278896 |
Post edited: Updated link |
— | about 4 years ago |
Comment | Post #281020 |
@Ayxan Haqverdili If it is a subclass, then the original code would have handled it differently than `std::runtime_error` yeah? Or otherwise there's no need for a dedicated `catch` block. (more) |
— | about 4 years ago |
Edit | Post #281020 | Initial revision | — | about 4 years ago |
Answer | — |
A: Multiple catches with almost the same code. There are many things we label as bad when programming, for various reasons. Repeating code is slightly bad. But writing function like-macros is extremely bad. You should not try to replace something slightly bad with something extremely bad. As it turns out, the programmer putting out fire with ... (more) |
— | about 4 years ago |
Edit | Post #280966 |
Post edited: Added some tags that suit the question |
— | over 4 years ago |
Edit | Post #280976 | Question closed | — | over 4 years ago |
Comment | Post #280976 |
This has nothing to do with software development. (more) |
— | over 4 years ago |
Comment | Post #280978 |
Thanks @Alexei. I think this was really just an accidental slip from all involved, I don't recall anyone actually arguing against troubleshooting questions. (more) |
— | over 4 years ago |
Comment | Post #277341 |
@Ayxan Haqverdili Whereas the proposed `-pedantic-errors` just turn all warnings related to C language violations into errors, which might be more useful. Particularly when you are playing around with other options that come with lots of false positives such as `-Wconversion`. (more) |
— | over 4 years ago |
Edit | Post #280969 | Initial revision | — | over 4 years ago |
Answer | — |
A: Are code troubleshooting posts allowed? You are right, the on-topic page is confusing - trouble-shooting and general programming questions should obviously be on-topic! Perhaps we considered it so obvious that it fell between the lines on What type of questions can I ask here? That on-topic page is still kind of in the draft stages. ... (more) |
— | over 4 years ago |
Comment | Post #280967 |
@Ayxan Haqverdili In order to do that, the compiler would have to implement some crazy scheme to keep the types different and non-compatible internally. And for what purpose, just to break code unexpectedly? Compilers, most notably gcc, has already received a tonne of criticism for strict aliasing a... (more) |
— | over 4 years ago |
Comment | Post #280967 |
@Ayxan Haqverdili It doesn't make sense for a compiler to implement any other character type than `unsigned char` so why would it? If there exists a type `unsigned char` which is 8 bits and another type `uint8_t` which is also 8 bits and neither have padding bits, why would you make them non-compati... (more) |
— | over 4 years ago |
Comment | Post #280967 |
@Ayxan Haqverdili The key here is 8 bit two's complement. Some manner of custom type could in theory have all manner of representations. `unsigned char` can only have one representation and `signed char` can only be 1's compl, 2's compl or signed magnitude. In case the system uses 2's compl and 8 bi... (more) |
— | over 4 years ago |
Edit | Post #280967 | Initial revision | — | over 4 years ago |
Answer | — |
A: Is `uint8_t` always an alias for a character type if it exists? Yes, it is in practice always a character type and you can safely assume as much, both in terms of (g)lvalue access and in terms of strict pointer aliasing. If not, the compiler would soon render itself completely useless. C and C++ both got the following rule (C17 7.20.1.1/3) > `intNt` ... `u... (more) |
— | over 4 years ago |
Edit | Post #280641 |
Post edited: typo |
— | over 4 years ago |
Comment | Post #278172 |
@Estela The terms operator precedence, associativity and order of evaluation ("sequenced before"/"sequenced after") are the same in C++. The only difference is that in later versions, C++17 and beyond has added well-defined order of evaluation for certain specific operators such as `=`. (more) |
— | over 4 years ago |
Comment | Post #280640 |
@jrh `uint8_t` will have to be a character type if supported, I've written answers explaining why on SO. But please don't derail comments further; this has nothing to do with endianess. If you have a question about strict aliasing, please ask a separate question. (more) |
— | over 4 years ago |
Comment | Post #280640 |
@Chris Jester-Young Furthermore, if you read the actual "strict aliasing rule", it has an explicit exception for lvalue access through a character type. C17 6.5/7: "An object shall have its stored value accessed only by an lvalue expression that has one of
the following types: ... - a character typ... (more) |
— | over 4 years ago |
Comment | Post #280640 |
@Chris Jester-Young No, that's wrong. There is a special rule allowing us to inspect any type in C by using a character type (uint8_t is always a character type if supported). C17 6.3.2.3/7. "When a pointer to an object is converted to a pointer to a character type,
the result points to the lowest ... (more) |
— | over 4 years ago |
Edit | Post #280640 |
Post edited: |
— | over 4 years ago |
Edit | Post #280640 |
Post edited: |
— | over 4 years ago |
Edit | Post #280641 | Initial revision | — | over 4 years ago |
Answer | — |
A: What is CPU endianness? This goes back to the various CPU architecture "wars" in the 1970s-1980s between the competitors Intel and Motorola (for example Intel 8086 vs Motorola 68000). For various reasons, CPUs from these two manufacturers ended up with different byte ordering in relation to each other. Byte ordering referri... (more) |
— | over 4 years ago |
Edit | Post #280640 | Initial revision | — | over 4 years ago |
Question | — |
What is CPU endianness? I was fooling around with the following C code on my trusty old x86 PC: ```c #include #include int main (void) { uint32t u32 = 0xAABBCCDD; uint8t ptr = (uint8t)&u32; for(sizet i=0; i<sizeof(uint32t); i++) { printf("%.2X", ptr[i]); } } ``` To my surprise, this print... (more) |
— | over 4 years ago |
Edit | Post #278172 |
Post edited: Formatting |
— | over 4 years ago |
Comment | Post #280536 |
@dmckee Yeah it sucks that various compilers decide to whine about that. It's like they never understood what #pragma is supposed to do in the first place. (more) |
— | over 4 years ago |
Comment | Post #280529 |
This new comment system sounds very promising overall - threaded comments would also be awesome too! (more) |
— | over 4 years ago |
Comment | Post #280536 |
Well, even in old school C you can simply use `#pragma` without any surrounding #ifdef. Compilers are supposed to simply ignore unknown pragmas and not whine about "unknown pragma". (more) |
— | over 4 years ago |
Comment | Post #280528 |
@dmckee Nan is going to be a special case no matter what you do. (more) |
— | over 4 years ago |
Comment | Post #280528 |
Compiler warnings are... compiler-specific :) You should probably manage these through different builds per compiler, if possible, keeping everything in IDE project settings or make files. Asserts in particular should be handled with debug vs release builds. As for exact floating point comparison, co... (more) |
— | over 4 years ago |
Comment | Post #280514 |
I would hope this gets implemented too. Couldn't find any feature request about it on meta.codidact though. (more) |
— | over 4 years ago |
Comment | Post #280449 |
It would probably be easier to generate a S-record or Intel hex file (text file formats). Then just search for the highest address, add this address to the size of the data stored at that address, then subtract the offset for where the flash starts from there. (more) |
— | over 4 years ago |
Comment | Post #280380 |
The terms "fullstack", "back end" and "front end" are only used in certain areas of programming. I think the terms are most commonly used in GUI and/or web applications(?). If you ask me, a "full stack" either means that the stack is full because you pushed too much onto it, or it means that you boug... (more) |
— | over 4 years ago |
Comment | Post #279895 |
The question was why to pick `do { } while(0)` over `{ }`. Your examples work just as fine with `{ }`. (more) |
— | over 4 years ago |
Comment | Post #279853 |
@Alexei It would be a perfectly fine use of meta to ask for feedback about a question draft before posting it live though. (more) |
— | over 4 years ago |
Comment | Post #279853 |
We actually discussed this very early on [here](https://forum.codidact.org/t/communities-dedicated-sites-for-professionals/320) (on the old forums, now closed). This was long before categories were invented though. (more) |
— | over 4 years ago |
Comment | Post #279853 |
As for having a separate newcomer site/category, it has been proposed many times before. I think it is easier to migrate the advanced topic to a separate site/category though. So for this specific site, it would mean that main Q&A should be the newbie friendly one, and we could add an "Expert" catego... (more) |
— | over 4 years ago |
Comment | Post #279853 |
The tabs = what's called categories on Codidact. (more) |
— | over 4 years ago |
Comment | Post #279772 |
Sounds like you can perhaps use some modified version of Prim's algorithm for the most efficient way to connect all nodes to a graph. Or some other manner of "greedy algorithm". (more) |
— | over 4 years ago |