Reputation
8,106
Top tag
Next privilege 10,000 Rep.
Access moderator tools
Badges
1 19 38
Newest
 Informed
Impact
~303k people reached

Jan
11
awarded  Informed
Jan
8
comment How do I have a group of numbers which total does not exceed a limit, and each number must be >= 0?
"Note that to make this work, you need to use traditional rounding rules, not integer math." It's more complex (consider [400, 400, 400] if you don't take the other values into account, you have a sum of 999 or of 1002). You need to truncate and then distribute the excess.
Jan
4
answered Is it true that calling _exit() instead of exit() won't prevent static destructors from being called?
Dec
24
awarded  Yearling
Dec
9
revised Is “string literal” always the same as “hard-coded string”?
added 120 characters in body
Dec
9
comment Is “string literal” always the same as “hard-coded string”?
@SherlockEinstein, take the reference manual for your favourite language, I expect to see the syntax of a string literal described in it (some may call it string constant but others prefer to use string constant for named constant object with a string type; I've never seen the word "literal" used for anything but a kind of token)
Dec
9
comment Is “string literal” always the same as “hard-coded string”?
@JAB, I'd not be surprised if there was variation about the precise meaning, even from one person. I tend to use hardcoded as soon as I don't have convenient way to modify it without modifying the program, even if it is determined at run-time (say it use the installation path of the executable) but I'd nor argue that a definition which require that the string be determined at compilation time. I'd tend to think a definition which won't include the concatenation of a string and a preprocessor macro overly restrictive.
Dec
9
awarded  Nice Answer
Dec
9
answered Is “string literal” always the same as “hard-coded string”?
Dec
1
comment Difference Between Unit Testing and Test Driven Development
@JacquesB, why? Our tests are not what you'd call unit tests by any definition, they depend too much on infrastructure and other components, but we still have enough observability that we -- well at least some of us -- are doing TDD.
Nov
27
comment Are include guards necessary if headers only contain declarations?
Macro definitions can be repeated. Type definitions can't and are common enough in headers to warrant the systematic use of guards. Cyclic includes seem a bad idea and difficult to make work, if you have one such example which would not be better re-factorized I'm interested in it. Playing tricks by defining the guard in another place than the header seems a recipe for issues later on.
Nov
26
comment Why '-5<(unsigned)5' is false?
Well there are two different models (I'll call them modular and positive) and you need two types. C choose one (modular -- unsigned was introduced because people abused less restrictive rules and pointer arithmetic to get that behavior) and it is a pain when you want the other one. Ada choose the other and ended up by adding modular types to gather for the cases where the C choice is desirable.
Nov
26
revised Why '-5<(unsigned)5' is false?
edited body
Nov
23
comment Is there anything that can be done with recursion that can't be done with loops?
@Yakk, I've taught lisp as an extension language for a program to people who are not programmers. Even when presenting loops after recursion (I've not done that too many times, that approach was too weird for the other trainers as well), loops are more natural for my trainee. They would use them even in cases when recursion is more natural for me that a loop, so that's not a bias I was passing to them.
Nov
23
comment Is there anything that can be done with recursion that can't be done with loops?
@Giorgio, when I taught programming years ago, I've seen multiple people coming up with the idea of loop and never seen someone not understanding the idea. I've never seen one coming up with the idea of recursion and saw multiple persons having trouble to understand it (it got better after I stopped using examples like factorial where the loop was so clearly better for them that they could not go over the apparent lack of interest).
Oct
9
comment Should UDP data payloads include a CRC?
Why cryptographic? The constraints used in designing cryptographic hashes are not the same as the one used in designing a hash used in transmission (for instance, being resource intensive is a feature for cryptographic hashes and and issue in transmission).
Jun
10
awarded  Nice Answer
Apr
17
comment Why was the Itanium processor difficult to write a compiler for?
@rwong, I made a TLDR of what I consider my main points. BTW, for me variable latency -- between models, data dependent for some instructions in some model, memory access is obviously a major category here -- is one aspect of the difficulty of parallelism extraction. CPU hardware has the advantage of dynamic scheduling, and I don't think there is an example of statically scheduled processor which is competitive on pure performance for single thread with OOO. I don't think even the Mill team make that claim (their merit factor include power).
Apr
17
revised Why was the Itanium processor difficult to write a compiler for?
added 194 characters in body
Apr
17
revised Why was the Itanium processor difficult to write a compiler for?
added 323 characters in body