1,040 reputation
720
bio website
location Europe
age
visits member for 1 year, 8 months
seen 8 hours ago

A developer by day, a coder by night.


Jul
2
awarded  Curious
Jun
28
reviewed No Action Needed Checked vs Unchecked vs No Exception… A best practice of contrary beliefs
Jun
26
awarded  Custodian
Jun
25
reviewed No Action Needed Is hadoop designed only for “simple” data processing jobs, where communications between the distributed nodes are sparse?
Jun
25
comment Is template “metaprogramming” in Java a good idea?
Indeed, assuming there is a performance benefit now, without measuring is folly. Your goal could be, make sure code gets inlined and optimized by JIT. Another thing is, if it works and doesn't need maintenance, don't fix it.
Jun
23
answered Is there a benefit in compiling your code as you go along?
Jun
23
comment Is there a benefit in compiling your code as you go along?
Quite often scripting code is developed "live", that is it is executed in REPL environment. So "compilation" indeed happens all the time, most code that is written to the source file has also been executed once. Not all write script code this way, but I'd say anybody used to and fond of the relative "safety" of statically typed languages and compiler errors given by bad code, they should work in scripting languages this way.
Jun
12
comment How to name a method that both performs a task and returns a boolean as a status?
@Doval about premature optimization: exceptions are often fundamental architectural aspect, and by the time there is meaningful profiling data, it's too late to change, it'd need too many changes. Premature optimization argument only really applies to internal implementations, parts that can be easily changed.
May
13
comment Do we tell the object to do something or do we do something (on/with/to/etc.) the object?
It's not necessary either of your two choices. Maybe it is a message to the object.
May
9
awarded  Notable Question
Apr
28
comment Why do C arrays not keep track of their length?
I guess another approach would be making all pointers boundary aware, essentially storing 3 values (start, current, end), and this is what you are probably thinking. Yeah, I agree that would be pretty big change to the language, and unfeasible (except maybe as extra type qualifier, checked char *ptr or something like that).
Apr
28
comment Why do C arrays not keep track of their length?
The way I see this could have gone is, first strip arrays out of the language (leave pointers and memory blocks allocated with malloc and standardized alloca, and maybe the [] syntactic sugar for *(ptr+ind). This does not really change semantics much, I think. Then add arrays back with new array semantics which include length, and resembling structs more than raw pointers.
Apr
28
comment Why do C arrays not keep track of their length?
The question asks about arrays. Pointer is memory address and would not change with question's premise, as far as understand the intention. Arrays would get length, pointers would be unchanged (except pointer to array would need to be a new, distinct, unique type, much like pointer to struct).
Apr
28
comment Why do C arrays not keep track of their length?
If arrays had runtime size, then pointer to array would be fundamentally different from pointer to an element of array. Latter might not be directly convertible to former at all (without creating new array). [] syntax might still exist for pointers, but it would be different than for these hypothetical "real" arrays, and the problem you describe would probably not exist.
Apr
28
comment Why do C arrays not keep track of their length?
I suppose it could be argued, that when C included using structs as parameter and return value types, it should have included syntactic sugar for "vectors" (or whatever name), which would underneath be struct with length and either array or pointer to array. Language level support for this common construct (also when passed as separate arguments and not single struct) would have saved countless bugs and simplified standard library too.
Apr
28
comment Why do C arrays not keep track of their length?
It's wrong to say C has no arrays, considering how you really can't generate same binary with other constructs (well, at least not if you consider use of #defines for determining array sizes). Arrays in C are "continuous sequences of data", nothing sugary about it. Using pointers like they were arrays is the syntactic sugar here (instead of explicit pointer arithmetic), not arrays themselves.
Apr
20
answered what is the javascript internal data structure?
Mar
27
awarded  Notable Question
Mar
20
comment Is a genetic algorithm needed when computation is infinitely fast?
If you have infinite memory and infinitely fast computation, you can just generate all possible states of the system, then evaluate every state and pick the ideal ones, or conclude that none of the possible states are satisfactory. "Infinite" makes the whole question kind of pointless IMO. Well, except if problem space is infinite too, but then we're quite far removed from anything a "programmer" might do.
Mar
20
comment Is doing an assignment inside a condition considered a code smell?
Indeed, for(;;) is a dead giveaway, that there's a break (or return) inside the loop. When not abused, it can make for a very clear yet concise loop construct.