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 |
---|---|---|---|---|
Comment | Post #281305 |
It's still there, more frequent than ever it seems. Just got it again after posting [this answer](https://software.codidact.com/posts/281518). Maybe it's related to formatting or how long you spend typing the answer? That one was very long, so I kept the browser upon for a wee while. By the way, may ... (more) |
— | about 3 years ago |
Edit | Post #281519 | Initial revision | — | about 3 years ago |
Answer | — |
A: Is strcpy dangerous and what should be used instead? Summary (TL;DR) - Using `strcpy` directly on non-sanitized user input is bad, otherwise it's fine. - `strncpy` is a dangerous function that should be avoided. Its presence in your source is a much greater danger than buffer overruns. - If portability and backwards-compatibility are no concer... (more) |
— | about 3 years ago |
Edit | Post #281518 | Initial revision | — | about 3 years ago |
Question | — |
Is strcpy dangerous and what should be used instead? I heard rumours that the `strcpy` function is dangerous and shouldn't be used. Supposedly it can be exploited to create buffer overflows somehow. And indeed when I compile my C code in the admittedly non-conforming Visual Studio C compiler, it warns me about using `strcpy` among other functions, ... (more) |
— | about 3 years ago |
Comment | Post #281511 |
What's the question? Is there a software development problem you are trying to solve? Are you designing a web browser? Are you reverse-engineering one? (more) |
— | about 3 years ago |
Comment | Post #281484 |
I guess they mean that you didn't have to declare the type because you are handed a default size integer. This was at least the case of B, BCPL and very early pre-standard C. (more) |
— | about 3 years ago |
Comment | Post #281474 |
@qsmodo Indeed there are lots of applications where the primitive types are never used and it is common to ban their use in coding standards. Proper introduction courses will address stdint.h. Alternatively you could use the peculiar rules from _Modern C/Gustedt_, where the recommended types to use ... (more) |
— | about 3 years ago |
Edit | Post #281474 |
Post edited: |
— | about 3 years ago |
Comment | Post #281255 |
Seems like it is more prone to happen when you edit your own answers. I just got it too while logged and have to do it twice as well. (more) |
— | about 3 years ago |
Comment | Post #281475 |
(Using Firefox). (more) |
— | about 3 years ago |
Edit | Post #281475 |
Post edited: |
— | about 3 years ago |
Edit | Post #281475 |
Post edited: |
— | about 3 years ago |
Edit | Post #281475 | Initial revision | — | about 3 years ago |
Question | — |
Code formatting of previews I just noticed that I'm not getting code formatting in the preview window when I write an answer or make an edit. This is very useful to have. Not sure if it's a bug so I'm posting this as a feature request. I'm not getting code formatting when I use language-specific formatting tags: ```c++ t... (more) |
— | about 3 years ago |
Edit | Post #281474 |
Post edited: |
— | about 3 years ago |
Comment | Post #281305 |
Link to the post that prompted for Captcha before I could post the answer: https://software.codidact.com/posts/281464#answer-281474. This contained code, but C (with C code formatting tags), not PHP. I'm always logged in to Codidact. Using Firefox. (more) |
— | about 3 years ago |
Comment | Post #281305 |
This keeps happening, it is very annoying. I just got this after a post where I was writing an answer, then went to edit the question post using the same browser window. Since I didn't trust the site to save the draft I was writing, I made a copy/paste of it first. When I returned to the answer, the ... (more) |
— | about 3 years ago |
Edit | Post #281474 | Initial revision | — | about 3 years ago |
Answer | — |
A: Warn of implicit cast in a function's arguments with GCC? You can use `-Wconversion` but you should be aware that it is very prone to false positives. It's a good flag to turn on during code review etc to shake out a few minor issues, but it's not a flag you should leave on permanently. gcc isn't very good at so-called static analysis in the first place.... (more) |
— | about 3 years ago |
Edit | Post #281464 |
Post edited: |
— | about 3 years ago |
Comment | Post #281464 |
Please note that there is no such thing as "implicit casting". There are implicit and explicit _conversions_. A cast is always an explicit conversion done by the programmer, by using the cast operator (). There is no casting present in your example. (more) |
— | about 3 years ago |
Comment | Post #281434 |
Your question is about gaming terminology, not software development. If I'm writing a microcontroller program for a dishwasher, then that doesn't mean that it's suddenly ok for me to start asking questions about dishwashers here. Such questions are about the functionality of the specific application ... (more) |
— | about 3 years ago |
Comment | Post #281434 |
This has absolutely nothing to do with software development. Kindly stop asking blatantly off-topic questions. (more) |
— | about 3 years ago |
Edit | Post #281434 | Question closed | — | about 3 years ago |
Edit | Post #281308 | Question closed | — | about 3 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 3 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 3 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 3 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 3 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 3 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 3 years ago |
Comment | Post #278896 |
@Ayxan Haqverdili I'll try to replace it with another, please try again now. (more) |
— | about 3 years ago |
Edit | Post #278896 |
Post edited: Updated link |
— | about 3 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 3 years ago |
Edit | Post #281020 | Initial revision | — | about 3 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 3 years ago |
Edit | Post #280966 |
Post edited: Added some tags that suit the question |
— | about 3 years ago |
Edit | Post #280976 | Question closed | — | about 3 years ago |
Comment | Post #280976 |
This has nothing to do with software development. (more) |
— | about 3 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) |
— | about 3 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) |
— | about 3 years ago |
Edit | Post #280969 | Initial revision | — | about 3 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) |
— | about 3 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) |
— | about 3 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) |
— | about 3 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) |
— | about 3 years ago |
Edit | Post #280967 | Initial revision | — | about 3 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) |
— | about 3 years ago |
Edit | Post #280641 |
Post edited: typo |
— | over 3 years ago |