1,047 reputation
59
bio website
location
age
visits member for 3 years, 7 months
seen 2 days ago

2d
comment Are all magic numbers created the same?
@Ryan: For this specific case, I'd rather be militant about the adoption of standard units - KB is 1000 bytes or the code is wrong, and 1024 bytes is KiB or the code is wrong. This is the only way we're ever going to get past the "units are ambiguous" problem. Different people defining "magic constants" (like KB) differently won't help.
2d
comment On-the-fly, random partition of a range of numbers [0,N] in groups of max M size
@nine: For small M it can be considered as O(N), and for large M (e.g. M = N*2) it can be considered O(1). Woot - it's O(1)! :)
Dec
25
comment Safety-critical software and optimising compilers
The GCC developers still do not understand that there's a massive difference between "technically allowed according to a literal reading of the C specs" and "sane in practice". The issue with GCC and signed integer overflow is that the C specs are bad (signed integer overflow should've been implementation defined from the beginning, and most implementations should've done wrapping to mirror the behaviour for unsigned integers and/or the target machine). "Undefined (by the spec) behaviour" does not exclude "defined by the implementation as wrapping".
Dec
23
answered Is embedding data in a executable considered a good practice?
Dec
22
answered What Are Some Advantages/Disadvantages of Using C over Assembly?
Dec
22
comment Cognitive Modeling Programming vs Imperative Programming vs Declarative Programming
Also; the "decide which actions they should perform" may be tiered. For example, you might have (less frequently executed) code to decide a long-term goal ("shark wants to find the middle of the ocean one day") and this creates more current state that influences the probability of the different actions being selected (e.g. makes the shark more likely to chase a merman west and less likely to chase a merman east).
Dec
22
comment Cognitive Modeling Programming vs Imperative Programming vs Declarative Programming
Note that "current state" can include past history (e.g. keeping track of where a shark saw a merman last, how often the merman evades left or right, etc), and various statistics (e.g. how hungry a shark is), and an entity's preferences/personalities (e.g. maybe you've got several sharks and some like the taste of mermans more than others).
Dec
22
comment Cognitive Modeling Programming vs Imperative Programming vs Declarative Programming
@achie: I have a low tolerance for worthless buzzwords (like "cognative modelling" and "reasoning engine"). The basic problem is that you've a current state (the state of the game world) and a set of "intelligent entities" that may perform a range of actions; and for each of those entities you need to decide which actions they should perform next based on the current state. This can range from extremely simple to extremely complex; mostly depending on how much "current state" you have and how much effort you put into the logic behind it.
Dec
21
answered Cognitive Modeling Programming vs Imperative Programming vs Declarative Programming
Dec
20
answered How to code a one-sided virtual economy
Dec
20
answered How to do “image shifting” faster?
Dec
17
answered Can a process that needs 15 MB run given a machine with 10 MB of physical memory and 10 of virtual?
Dec
16
comment Is it misleading to label code as a particular design pattern if it only loosely fits the definition?
@Dunk: I think it's the opposite. Most people write code to solve problems (often without caring about design patterns and sometimes without knowing about design patterns at all), and design patterns were created by finding things that were common in very different pieces of code (in the same way that people see shapes like faces, elephants, cats when they see clouds, or decide a pattern of stars looks a bit like a saucepan).
Dec
15
comment On-the-fly, random partition of a range of numbers [0,N] in groups of max M size
Given "a range of numbers from 0 to N", where K is the number groups; my solution would be O(K) and not O(N).
Dec
14
comment Maintenance cost of SIMD programming code base
I like to have both the clean/simple/slow code (for initial proof of concept and later documentation purposes) in addition to the optimised alternative/s. This makes it easy to understand (as people can just read the clean/simple/slow code) and easy to verify (by comparing the optimised version to the clean/simple/slow version manually and in unit tests)
Dec
1
answered On-the-fly, random partition of a range of numbers [0,N] in groups of max M size
Nov
27
comment What are some advantages of having a cursory understanding of computer programming, in unrelated fields?
Knowing how a car works helps you be a better driver. In the same way, knowing how a computer works helps you be a better user. This doesn't necessarily imply that learning a programming language is useful. Note: Every time someone calls a monitor "their computer", or has no idea what the difference between hard disk space and RAM size is, a small part of me dies.
Nov
27
comment How to choose between different ways to write some code?
Note that often you want "validate and parse" (e.g. return integer co-ords) and not "validate, then parse" - for the latter case, half the work needs to be done twice. Also, for all parsing good code returns descriptive errors (was the comma missing? was the integer out of range? was the string empty?).
Nov
25
comment Merge sort versus quick sort performance
Also note that once your data is larger than the CPU's cache, the "big O" figures mentioned here become worse than nothing (misleading) as they count "operations" (which aren't important) and not cache misses (which are far more important).
Nov
24
awarded  Pundit