Reputation
9,451
Top tag
Next privilege 10,000 Rep.
Access moderator tools
Badges
1 20 50
Impact
~438k people reached

1d
comment Concurrent languages and non-concurrent dependencies
Would any message-queue architecture (anything that's called "MQ" these days) placed before the workers (i.e. acts as the workers' frontend) be able to perform the batching correctly?
Feb
10
comment Is it possible to detect misuse of passing self type argument in compile time?
@greenoldman Please add this to the question text, and update the question title as well.
Feb
10
comment Is it possible to detect misuse of passing self type argument in compile time?
Consider this: C# doesn't implement its unicode char instances as a hierarchy that mirrors the unicode categorization. It would have been impossible to do so, for reasons similar to what you discovered.
Feb
10
comment Is it possible to detect misuse of passing self type argument in compile time?
@greenoldman C# gives you sealed to prevent further inheritance. Unfortunately, if inheritance leads to unexpected behavior and the language doesn't give you the tools for preventing that, you have to consider limiting your use of inheritance, or switch to another language or implementation style.
Feb
10
revised Is it possible to detect misuse of passing self type argument in compile time?
deleted 19 characters in body
Feb
10
revised Is it possible to detect misuse of passing self type argument in compile time?
deleted 19 characters in body
Feb
10
revised Is it possible to detect misuse of passing self type argument in compile time?
added 83 characters in body
Feb
10
answered Is it possible to detect misuse of passing self type argument in compile time?
Feb
9
comment stack based vs heap based overflow
Terminology: this is why "overflow" is not a technically unambiguous word. Instead, please clarify whether it is "overrun" - overwriting of memory space located outside (at some higher address) of an object, or "exhaustion" - merely a failure to request allocation of more memory. Exhaustion typically leads to orderly or abruptly shutdown; "overrun" in unmanaged environments (such as C, C++) leads to undefined behavior, with the possibility of data corruption, altered program behavior (not statically analyzable) or arbitrary code execution.
Feb
8
comment Avoiding Division by Zero Using Float Comparison
@Alfe Your true question is very context-dependent. I won't be able to give a useful answer to your question because there's insufficient context. But it sounds like you already got the idea.
Feb
8
comment Avoiding Division by Zero Using Float Comparison
@Alfe then it becomes a design-by-contract (or precondition) question. If your static analysis software supports it, you can add an assertion that caller is responsible for ensuring the divisor is not zero, which has the effect of shifting the static analysis checker's focus to the caller, and so on. Similar to how exception specification (catch or throw) works.
Feb
8
comment Suggestions for Storing large collection of related words
I just did a Google search with "ontology" and "sentence generator" and this paper is returned as a hit. Just for reference only. I am not familiar with this area. aueb.gr/users/ion/docs/naturalowl_eacl2009.pdf
Feb
5
comment Avoiding Division by Zero Using Float Comparison
It is worth mentioning that for the evaluation of sin(x)/x for small values of x, one would switch over to an asymptotic formula of it for an entire range. In the case of sin(x)/x it is easy because the asymptotic formula evaluates to be a constant of 1.0, but in other cases (different formulas), the asymptotic formula may depend on the value of x, however small it is.
Feb
5
comment Is it possible to move a pointer from one item to another on the stack?
The details are not exactly correct (see Erik Eidt's answer to see why the variable b is more likely to have been eliminated in a release build) but the line of thought is correct. For example, if we are told that the value of b is indeed written into memory, one could have written a stack scanner to search for addresses that match b's expected value, and thus recover its address, or narrow down to a few possible candidates. This adversarial mindset is necessary for some areas of software development.
Feb
5
answered Understanding the Single-Writer Principle
Feb
5
comment Understanding the Single-Writer Principle
"... trying to write into some proper queue" can you elaborate what you mean by "proper queue"? A queue on a single computer with low-overhead "lock-free" technique and accessed by CPUs all on cache-coherent interconnects?
Feb
5
comment Understanding the Single-Writer Principle
Disruptor is about one-to-one direct queues (i-th producer and j-th consumer), and are supposed to run on a small number of computers (nodes) on a fast and reliable network physically located together. Facebook or AWS are about distributed queues across geographics, which require an entire book to explain, but the AWS SQS introduction gives a decent picture. It is not so much "performance-wise" but rather what you do when the system's size becomes bigger than could be fit on a single computer.
Feb
5
comment Avoiding Division by Zero Using Float Comparison
@Alfe: I think the question you wanted to ask (but had difficulty phrasing) is really a question about error-handling philosophy: whether the caller or callee should have the bigger burden of checking for and handling a potentially failable operation.
Feb
5
revised Avoiding Division by Zero Using Float Comparison
added 373 characters in body
Feb
5
comment Avoiding Division by Zero Using Float Comparison
@Alfe: yes, it is likely that the caller (1) should know more about why it happens, and (2) is in a better position to decide what should be done. In some cases, the caller could specify a substitute value (0.0 or 1.0 or something else), a placeholder value (Inf, NaN, 1e+10, empty string, or something else), or to call a callback function. Of course it could also be possible that the user isn't sophisticated enough (think of the typical spreadsheet users).