Reputation
3,869
Next privilege 5,000 Rep.
Approve tag wiki edits
Badges
9 21
Newest
 Nice Answer
Impact
~115k people reached

  • 0 posts edited
  • 5 helpful flags
  • 98 votes cast
Jun
29
comment What are the advantages of build scripts?
I too am one of those developers. I don't want my fingers to have to leave the keyboard. Doing so interrupts my thought processes.
Jun
29
comment What are the advantages of build scripts?
It's not just a matter of different IDEs. Some developers hate and loathe IDEs of all types.
Jun
18
awarded  Nice Answer
Jun
11
comment What is the “type” of data that pointers hold in the C language?
A char is always 1 byte in C. Quoting from the C standard: "The sizeof operator yields the size (in bytes) of its operand" and "When sizeof is applied to an operand that has type char, unsigned char, or signed char, (or a qualified version thereof) the result is 1." Perhaps you are thinking a byte is 8 bits long. That is not necessarily the case. To be compliant with the standard, a byte must contain at least 8 bits.
Jun
9
comment What is the “type” of data that pointers hold in the C language?
In your example, if p is of type char* (or int8_t), then p+1 is numerically ox1B. But if p is of type short (or int16_t), p+1 is ox1C or 28 on most computers. That is not how integers add. Pointers are not integers.
Jun
6
comment Accessing member of vector< pair<pair<int,int>, int> >
@rwong - D'oh! I edited my answer to incorporate your comment.
Jun
6
revised Accessing member of vector< pair<pair<int,int>, int> >
added 456 characters in body
Jun
6
comment Accessing member of vector< pair<pair<int,int>, int> >
(1) Your code doesn't compile on my machine, with multiple compilers. There is no <bits/stdc++.h> to include. (2) What's with #define _? You're not using it anywhere. (3) What's with #define pb etc? That kind of stuff is good for the International Obfuscated C Code Contest, but not here.
Jun
6
comment Accessing member of vector< pair<pair<int,int>, int> >
There is a whole lot that is wrong with this code.
Jun
6
answered Accessing member of vector< pair<pair<int,int>, int> >
Jun
5
answered Why would a program use a closure?
May
31
awarded  Yearling
May
23
comment Short circuit evaluation, is it bad practice?
@FedericoPoloni - There's a way to do it. There's more than one way to do it! Just change the exclamation mark in the string the dollar-bang: open($handle, "<", "filename.txt") or die "Couldn't open file: $!";
May
7
comment Is renaming an 'alias' for moving?
@BanksySan - The reason I asked was that there a distinction can be made. There's a big difference between changing the contents of folders/directories but leaving the file untouched versus copying the file to a new location, deleting it from the old location, and changing the contents of folders/directories to reflect those actions.
May
6
answered Is renaming an 'alias' for moving?
May
6
comment Is renaming an 'alias' for moving?
@BanksySan - How do you distinguish between "rename" and "move"? (They're interchangeable words on many systems.)
May
4
comment Have any C compilers ever *defined* `unsigned short x=-3; x*=x;` to yield anything other than 9
@supercat - I'm done. I strongly suggest you read the standard. If your compiler vendor isn't compliant, get another compiler vendor.
May
4
comment Have any C compilers ever *defined* `unsigned short x=-3; x*=x;` to yield anything other than 9
@supercat - You are barking up the wrong tree. Early in the days of C, there were lots of compilers that didn't comply with the defacto standard of the time, K&R C. This hindered portability. Every program was sprinkled with #if (defined THIS_COMPUTER && THIS_COMPUTER) ... #elsif ... The purpose of a standard is to eliminate some of that nonsense. Even C90 specifies that unsigned integers use modular arithmetic. So long as k*k is less than n+1, (((n+1)-k)*((n+1)-k)) % (n+1) == k*k. It's basic math.
May
4
comment Have any C compilers ever *defined* `unsigned short x=-3; x*=x;` to yield anything other than 9
@supercat - I do remember that some dropped core at the drop of a hat. I haven't run into a C compiler that doesn't comply with ANSI C (C89/C90) for at 15 or 20 years, so you are asking me to reach way back.
May
3
comment Have any C compilers ever *defined* `unsigned short x=-3; x*=x;` to yield anything other than 9
@supercat - Ever? Of course. The mid 1970s to the mid 1990s was the age of the minicomputers. There were lots of minicomputer manufacturers; almost all of them are now gone. Lots of them had lousy compilers, goofy architectures. (For example, middle-endian computers). You didn't overflow, signed or unsigned, in those days if you wanted your code to be portable. Nowadays, a compiler that is not at a minimum ISO/IEC 9899:1990-compliant is a completely broken beast from a previous millennium. Even in that 25 year old version of the standard, it's very clear how unsigned integers work.