Reputation
4,935
Next privilege 5,000 Rep.
Approve tag wiki edits
Badges
2 15 29
Newest
 Announcer
Impact
~134k people reached

Dec
7
comment Checking if a method returns false: assign result to temporary variable, or put method invocation directly in conditional?
@cmaster: One problem with comments is that they can very easily get out of sync with the code. A variable named done_processing is a more durable way of expressing the intent.
Dec
7
revised Checking if a method returns false: assign result to temporary variable, or put method invocation directly in conditional?
Formatting
Nov
30
comment Why Use !boolean_variable Over boolean_variable == false
@KRyan: Equality comparison to false happens to be "safe", since 0 is the only "false" value -- but it's IMHO better to avoid equality comparison to either true or false in general.
Nov
30
comment Why Use !boolean_variable Over boolean_variable == false
@KRyan: That doesn't appear to be correct. This: std::cout << (2 == true ? "yes\n" : "no\n"); prints no. The usual arithmetic conversions don't convert int to bool.
Nov
6
comment typedefs and #defines
@Yay295: Yes, it is -- but if the intent was to make DWORD an alias for the type long, then it doesn't make any sense to use DWORD double to refer to the type long double. If DWORD were a typedef, the compiler would catch the error.
Oct
11
awarded  Announcer
Sep
18
comment Writing programs without graphical IDE
@OscarRyz: cat is inefficient. gzip -d > filename takes fewer keystrokes.
Aug
26
comment Automatically reverting commits that fail the build
"The CI should never alter the commit history of the repo." Of course not; I don't think that's what was being suggested. Reverting a commit via the git revert command doesn't change history. It applies a new commit that reverses the change made by a previous commit. The original commit is still there.
Aug
23
revised Is it necessary to read every single byte to check if a copied file is identical to the original?
typo
Aug
4
awarded  Yearling
Jul
5
comment What is the difference between function() and function(void)?
@ruakh: A variadic function must be declared and defined using the ... syntax to avoid undefined behavior.
Jun
16
comment What is the difference between function() and function(void)?
A C variadic function must be defined with the ... syntax, and it must have at least one named parameter. Defining such a function with () causes undefined behavior -- and there's no way for the body of the function to use the macros defined in <stdarg.h> to read the parameter values. This has been the case since the 1989/1990 standard.
May
20
comment Short circuit evaluation, is it bad practice?
@linac: In C and C++, && is short-circuit and & is not, but they're very different operators. && is a logical "and"; & is a bitwise "and". It's possible for x && y to be true while x & y is false.
Feb
19
awarded  Good Answer
Jan
27
revised Should Perl scripts really have no extension?
added 325 characters in body
Jan
27
answered Should Perl scripts really have no extension?
Jan
27
comment Should Perl scripts really have no extension?
C compilers commonly treat their input files differently depending on the extension. For example, gcc treats . as C source code, .cpp, .cc, .C as C++ source code, .o as an object file to be passed on to the linker, and so on. You can override that with a command-line option, but I've used it so rarely that I don't remember what it is. The .c extension for C source files is important. The .pl extension for executable Perl scripts is not (at least on UNIX-like systems).
Sep
30
awarded  Explainer
Aug
15
comment How does the “Fourth Dimension” work with arrays?
At least in C, a 2-dimensional array is nothing more or less than an array of 1-dimensional arrays. An N-dimensional array is an array of N-1-dimensional arrays. Other languages define these terms differently, but the semantics are similar (though the ordering may vary).
Aug
4
awarded  Yearling