1,085 reputation
821
bio website
location Europe
age
visits member for 2 years, 1 month
seen 3 hours ago

A software developer by day, a human developer by night.


3h
comment Are all magic numbers created the same?
This answer could benefit from a mention, that some "obvious" numbers, 1024 definitely being one, are such that other developers are very likely to spontaneously write them as numbers, even when someone defines a named constant for them. I for one most likely would not even think of searching the source code for existing constant for 1024 if I didn't already know there is one, if I needed to use 1024 in byte amount conversion.
Nov
8
comment Is it good practice to rely on headers being included transitively?
A note about including unnecessary headers, it does matter to compilation times, first of directly (especially if it is template-heavy C++), but especially when including headers of same or dependency project where the include file also changes, and will trigger recompilation of everything including it (if you have working dependencies, if you don't then you have to be doing clean build all the time...).
Nov
8
comment Is it good practice to rely on headers being included transitively?
Note about order of includes: sometimes the order is important, for example when including X11 headers. This can be due to design (which might in that case be considered bad design), sometimes it is due to unfortunate incompatibility issues.
Oct
27
awarded  Yearling
Sep
24
awarded  Autobiographer
Aug
27
answered Multithreading: am I doing it wrong?
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.