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 celtschk‭

Type On... Excerpt Status Date
Edit Post #285351 Initial revision almost 3 years ago
Answer A: What is malloc's standard-defined behavior with respect to the amount of memory it allocates?
Since accessing the memory allocated by `malloc` beyond the size given to the call is undefined behaviour (which means that the standard poses no restriction to the behaviour of a program that does this), and since there's no standard way to determine the length of the allocated block, malloc is inde...
(more)
almost 3 years ago
Comment Post #285243 You don't even need memory-mapped registers to get such effects. Even on a conventional stack layout, an out of bounds access might go to the stored address of the parent stack frame, or to the return address. Changing the first one may cause the stack pointer being changed to a wrong value later(!),...
(more)
almost 3 years ago
Edit Post #285240 Initial revision almost 3 years ago
Answer A: Behavior of Pointer Arithmetic on the Stack
Not only does the C language not guarantee it, it also will fail on actual compilers, as soon as you enable optimisation (which you'll generally want to do because you want your code run fast, after all). Try it online! – Try It Online")
(more)
almost 3 years ago
Edit Post #285137 Initial revision almost 3 years ago
Answer A: Why does fopen return NULL?
Besides the possible issues that Lundin told you, there is also the possibility that the current directory of the program is not what you think it is (note that the current directory is not necessarily the directory the executable is in, nor is it necessarily your user directory). This problem is unl...
(more)
almost 3 years ago
Edit Post #285102 Initial revision almost 3 years ago
Answer A: Invalid memory access when trying to dereference a pointer obtained through a function call
Your function returns a pointer to a local non-static variable. Such a variable exists only during execution of the function and is removed on return. This means you are left with a so-called dangling pointer, a pointer that points to a no longer valid address. Note that using such a pointer is un...
(more)
almost 3 years ago
Comment Post #284552 Obvious to a reasonable person with the knowledge level of the OP.
(more)
about 3 years ago
Comment Post #284552 On the other hand, if it isn't obvious what the OP should have searched, then IMHO the downvote is not justified.
(more)
about 3 years ago
Comment Post #277341 Another point: Compilers are also allowed to give diagnostics on correct programs, as long as they generate working code otherwise. A compiler that always outputs the diagnostic “This program might contain errors” is completely conforming as long as it correctly compiles correct code. In other wor...
(more)
about 3 years ago
Comment Post #284510 Well, the extra information you added spells out the crucial bit (closing of file handles that weren't closed before; thanks to that now I have an idea what went wrong before), therefore have my +1. Links are not that relevant (except when not using them would violate a license or result in plagia...
(more)
about 3 years ago
Comment Post #284510 Can you please be explicit on how that version differs from the original one? And what that crucial hint was?
(more)
about 3 years ago
Comment Post #284444 Well, for each dictionary *that you want to access this way.* And an instance is cheap, isn't it? However thinking of it, one useful addition would be to recursively treat dictionary values (possibly controlled by a constructor option), by automatically wrapping them as well if accessed as attributes...
(more)
about 3 years ago
Comment Post #284444 An additional class for each dictionary? You didn't actually read my code, did you? But yes, the goal is syntactic sugar. Being able to use `proxy.foo` instead of `dictionary["foo"]`.
(more)
about 3 years ago
Edit Post #284444 Initial revision about 3 years ago
Question A class to access dicts using attribute syntax
I've written a class that allows to access dictionary entries of arbitrary dicts with appropriate string keys through attribute access syntax on an instance of the class. My questions are: 1. Is this class a good idea to begin with? 2. Is there anything that should be done differently? ...
(more)
about 3 years ago
Comment Post #282566 The reason for the `-ansi` misunderstanding is history (and IMHO a bad choice by the compiler developers). Originally (at a time where only one version of the C standard and one version of the C++ standard existed), `-ansi` was indeed the correct way to enforce standards conformance; the `-std` optio...
(more)
about 3 years ago
Comment Post #284343 I notice that your Java installation line contains the word “headless”. “Headless” basically means “without screen”. Therefore I'd guess that the remaining problem is that you installed the wrong version of jdk. From a bit of internet search, I suspect that you'll get what you want with `sudo apt ins...
(more)
about 3 years ago
Comment Post #284343 On Linux (and generally, on Unix systems using the X11 window system), the DISPLAY environment variable tells how to connect to the X server, which manages the graphical display. Apparently something tried to open a window. I don't know anything about netbeans, but I see two possibilites: * Eith...
(more)
about 3 years ago
Comment Post #284265 Yes, submarines can “collide” with each other (they just move through each other). If I were not distinguishing between bombs and submarines, then each such collision would cause a collision detection. While the submarines disappearing wouldn't be *that* bad (well, the submarines collided, after all)...
(more)
about 3 years ago
Comment Post #284265 I just noticed that I forgot replying to your remark on the movement code. Actually when I started writing the code, I first went with the increments version, but given the various movement directions, I quickly realised that testing the end condition would be quite complex; therefore I decided to...
(more)
about 3 years ago
Comment Post #284265 Thank you very much for the analysis. On the two line separation, I didn't now that convention, but it makes a lot of sense. I'll definitely do that. On the 80 character line length, my Emacs opens up at that width, and I like to have space for a terminal (and occasionally other windows) beside...
(more)
about 3 years ago
Edit Post #284194 Post edited:
Added missing part of settings.py
about 3 years ago
Edit Post #284258 Initial revision about 3 years ago
Answer A: Detecting balanced parentheses in Python
You've got an inefficiency in your code, as you always do replacements 3/2 times the length of the string. That is unnecessarily expensive. By instead testing in each iteration whether the length actually changed, you get a much improved performance: ``` def isvalid(s: str) -> bool: if le...
(more)
about 3 years ago
Comment Post #284178 @#53185 4.3 billion cents is 43 million dollars.
(more)
about 3 years ago
Comment Post #284232 I may be wrong, but the way I interpret the text you quoted, it is deprecated because the corresponding functionality isn't there anymore. If so, you won't find a replacement.
(more)
about 3 years ago
Edit Post #284193 Post edited:
Made exponent to actual minus sign (looks better)
about 3 years ago
Edit Post #284194 Initial revision about 3 years ago
Question A simple game with pygame
I've just started playing around with pygame and have written a small game in it, of which I'd like a review. Note that I'm not only a complete beginner in pygame, but I also have very little experience in Python in general, therefore I also would welcome comments on my Python code that are not relat...
(more)
about 3 years ago
Comment Post #284192 Thank you. I'm going to post soon.
(more)
about 3 years ago
Edit Post #284193 Initial revision about 3 years ago
Answer A: Why is it considered bad practice to use float for representing currency?
The main problem with using floating point is that the typical floating point type is binary floating point. But in binary floating point, most decimal fractions cannot be represented exactly. That is, if you store the number 9.95 in a floating point number, the number that you are actually storing i...
(more)
about 3 years ago
Comment Post #284178 Actually the correct way to deal with the rounding issue is to calculate not in cents (or whatever the minimum value is), but in units of e.g. a thousandth of a cent, and then explicitly round to cents only at the end of your calculation. This is mainly because of double-rounding errors. Of course th...
(more)
about 3 years ago
Edit Post #284188 Initial revision about 3 years ago
Question Is this a good fit for Code Reviews, and if so, how to best post it?
I've just dived into pygame and written a little game in it, of which I'd like a review (it's my first try of pygame). However I'm not sure if it is a good fit for the site, and if so, how exactly I should post it. First, the rules ask for complete code. Here's what `wc` says about all the Python ...
(more)
about 3 years ago