Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »

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
Answer A: Should we allow answers generated by ChatGPT?
After some more experience from this bot over a couple of months, I would say that we should ban it simply because: The answers it gives are often wrong. ChatGPT has been hyped up ridiculously. It is not that good, it is not that smart, it cannot be trusted to give correct answers to complex to...
(more)
about 2 years ago
Edit Post #287123 Post edited:
about 2 years ago
Comment Post #287760 @#53937 No that's really the same thing. Structs and arrays mostly follow the same rules in this case (being "aggregates" as far as the effective type rules are concerned).
(more)
about 2 years ago
Edit Post #287760 Initial revision about 2 years ago
Answer A: Is partial allocation of an object Undefined Behavior?
Since I don't think the C standard says anything explicitly about cases like this, it is probably undefined behavior, under the "not mentioned in the standard" variety. If something isn't mentioned, it is per definition undefined and not well-defined. The closest thing might be the somewhat unclea...
(more)
about 2 years ago
Edit Post #287748 Post edited:
Typo
about 2 years ago
Edit Post #287750 Initial revision about 2 years ago
Answer A: Strict aliasing rules and function boundaries
Assuming that there are no alignment problems between the two pointer types (impl-defined), the code is otherwise well-defined. As per the quoted 6.3.2.3 C allows pretty much any form of wild and crazy pointer conversions by means of a cast, as long as you don't actually de-reference the pointer thro...
(more)
about 2 years ago
Comment Post #287607 Are Java and C# `interface` common enough to justify using the same tag? Otherwise maybe two tags java-interface and C#-interface would solve the problem. I see no purpose of the tag outside these specific language keywords.
(more)
over 2 years ago
Comment Post #285727 I'd say that the "three pillars" are private encapsulation, autonomous objects and inheritance. Autonomous objects meaning that each object just does it's own designated task and doesn't meddle with other unrelated things - it has _loose coupling_, as few dependencies on other things in the program a...
(more)
over 2 years ago
Comment Post #287561 Just ask the same question here. What answer you got elsewhere and from whom is irrelevant.
(more)
over 2 years ago
Edit Post #287504 Initial revision over 2 years ago
Answer A: Are questions about language design on-topic?
The ambition of this site was always to give more room for subjective and big picture questions compared with Someplace Else. However, I believe programming language design falls under the topic of general computer science. It doesn't match anything in the current on-topic list. General computing...
(more)
over 2 years ago
Comment Post #287454 Great job everyone who was involved in finally fixing this!
(more)
over 2 years ago
Comment Post #287301 The problem with "non-authoritative" recommendations is that they become completely subjective. If some random person with random experience likes a certain book, then that doesn't tell us anything more than a random subjective review on Amazon - it all turns low quality and unlikely to be of actual ...
(more)
over 2 years ago
Edit Post #287123 Post edited:
over 2 years ago
Comment Post #287137 A quality list goes beyond "I have read it and it was good" though, because everyone can read a book and share an opinion of it. You can then get a recommendation about how easy to read and pedagogic the books was (similar to Amazon reviews perhaps). But not a measurement of technical correctness. So...
(more)
over 2 years ago
Edit Post #287123 Initial revision over 2 years ago
Answer A: Should asking about book recommendations directly connected to software development be on-topic?
As someone who spent a lot of time trying to get this to work on Stack Overflow, I would advise against it. Some background story of my merry adventures with book lists: The story starts around here: Delete the list of random books? Back in 2015 I stumbled upon a list of random books not n...
(more)
over 2 years ago
Comment Post #287122 One of the most important things I was taught in physics classes back at school was to _always_ convert each operand to the basic SI unit before using it in calculations. That is, always convert km to m. Always convert hours/minutes to seconds. And so on. This for manual calculations - programming is...
(more)
over 2 years ago
Edit Post #287079 Post edited:
over 2 years ago
Edit Post #287079 Post edited:
over 2 years ago
Edit Post #287079 Post edited:
over 2 years ago
Edit Post #287079 Post edited:
over 2 years ago
Edit Post #287079 Initial revision over 2 years ago
Answer A: C naming convention, module trigrams?
For what it's worth, I have some 20 years of experience designing embedded C systems, with large and small code bases both. Code design is some of the hardest things to do, since books about object orientation (OO) etc only gets you so far - you have to learn what works out of experience. Generall...
(more)
over 2 years ago
Comment Post #286979 The volatile part doesn't make it UB because of the lvalue access alone, but because of the special rule in 6.3.2.1 which has nothing to do with the value of the variable or traps, but code generation.
(more)
over 2 years ago
Comment Post #286975 @#53398 For the most part it _is_ fine to use such a variable, as in it won't cause you program to crash and burn (not undefined behavior), but it will not produce anything meaningful or deterministic either (it is unspecified behavior). With the exception of trap representations, which are mostly ir...
(more)
over 2 years ago
Edit Post #286987 Post edited:
over 2 years ago
Comment Post #286979 "we can even read an uninitialized variable with unspecified value safely" This is an over-simplification. Reading a local variable (automatic storage) which was not initialized and never had its address taken (could have been declared with `register` storage class) is explicitly UB as per C17 6.3.2....
(more)
over 2 years ago
Edit Post #286987 Initial revision over 2 years ago
Answer A: Cast uninitialized variable to (void)
It depends. This boils down to whether or not the expression cast to `void` contains any side effects, such as accessing a `volatile`-qualified object or modifying any object. C17 6.3.2.2: > If an expression of any other type is evaluated as a void expression, its value or designator is discar...
(more)
over 2 years ago
Edit Post #286947 Initial revision over 2 years ago
Answer A: Asking and answering FAQ style questions
Yes it is fine and probably encouraged even. I have written several self-answered Q&A here and they were mostly well-received. They aren't all that easy to write though, especially getting the question right and meaningful, so that people looking for that same problem can find it - or at least so tha...
(more)
over 2 years ago
Edit Post #283890 Post edited:
over 2 years ago
Comment Post #286813 I assume you meant to write data-presentation but it is missing from the question.
(more)
over 2 years ago
Edit Post #286870 Initial revision over 2 years ago
Answer A: Renaming GNU/Linux tag to gnu
I don't think GNU can be used as a stand-alone tag. Apart from the OS, GNU is also a tool collection of various programs, many used for programming, making is a very ambiguous tag which can't stand on its own. Any use of the tag needs to also specify what it's actually about: the OS or one of the ...
(more)
over 2 years ago
Comment Post #286628 Ok, well... conditional compilation is always messy. I would consider solving this through version control and program design instead. As in, include a foo.h with the common interface, then link either A_foo.c or B_foo.c depending on version.
(more)
almost 3 years ago
Comment Post #286628 Not entirely sure what problem you are trying to solve, but is there any reason why you can't do `if (e) { _Static_assert(!e,"Called but not in binary."); } \` instead, something like that? To get a readable compile-time error instead of a mysterious link-time one?
(more)
almost 3 years ago
Edit Post #286593 Post edited:
almost 3 years ago
Edit Post #286593 Initial revision almost 3 years ago
Answer A: How to write a macro that discards the const qualifier, for any type?
Ignoring the numerous forms of undefined behavior that casting away `const` might invoke, the blunt but simple and standard solution is just to cast to `(void)`. ```c char foo (const char str) { return (void)str; } ``` This is far more portable than gcc extensions like `typeof`. ...
(more)
almost 3 years ago
Comment Post #286575 @#53937 There are various tricks involving union type punning where the union members are pointers of different qualifiers. But that mostly relies on the C rules of effective type being underspecified in regards of type qualifiers, so I'm not sure if anyone could tell if it would be well-defined or n...
(more)
almost 3 years ago
Comment Post #286578 There's nothing in the C standard mentioning linking, so how and when these get linked is highly system-specific. On the average embedded system for example, each example will end up in true read-only memory at link-time.
(more)
almost 3 years ago
Comment Post #286575 Most of the time, you don't want to discard const qualifiers since that invokes undefined behavior in many cases. The appropriate solution is either to do a copy of the value or to reconsider your design.
(more)
almost 3 years ago
Comment Post #286440 @#36396 PID in the context of desktop/system programming means process identity. The less common meaning of it would be Proportional-Integral-Derivative controller. That's the two industry de facto standard meanings of the term - any other meaning isn't well established. In the context of Unix progra...
(more)
almost 3 years ago
Comment Post #286372 The operator precedence will be the same as in basic math... so it's not even a programming problem.
(more)
almost 3 years ago
Comment Post #285999 @#56561 This is about the code review category of this site so it doesn't apply.
(more)
almost 3 years ago
Comment Post #283440 @#36396 If you are lucky then yes. With gcc you have to do `-Wall` to enable the warning for example.
(more)
almost 3 years ago