rpath

Oct. 2, 2016, 11:56 a.m.

I am an ardent practitioner of the Six Stages of Debugging. One is forced to, when one's software needs to simultaneously work on Mac OSX and RHEL5 Linux and modern Linux (these two are, in fact, very different). Until the cows actually come home and the day of the Linux desktop is here, I have to continue contending with OSX and its eccentric ways.

One of which is how OSX handles run-time search paths for shared libraries that you build yourself. CMake luckily has a great explanation of rpath differences in Linux and Macs. It's a beautiful default behavior until Linux screams at me with SYMBOL LOOKUP ERROR GOODBYE while everything seemingly chugs along in OSX. I'm assuming this is because nobody cares about Unix portability at Apple. In any case, for these situations -Wl,-rpath, is probably the easiest thing to do without modifying other people's LD_LIBRARY_PATH or system libs.

glibc++11 ABI

Oct. 1, 2016, 10:45 p.m.

I had thought being able to define lambdas and thus opening up an entire new way to obfuscate your C++ code was the most revolutionary thing about C++11, until I learned that glibc++ literally broke their ABI in order to properly follow the C++11 spec regarding containers. As usual, I only learn about exciting developments when it breaks my code, namely, when I tried to link fancy new C++11 code with old and ugly libraries compiled in the pre-C++11 days. This is as taboo as trying to run Python 2.7 code with a Python 3 interpreter - your print statements (or rather, linear complexity list::size()) has no place here.

Luckily we can always #define _GLIBCXX_USE_CXX11_ABI 0 to perpetuate a broken ABI just as Python developers refuse to migrate to py3!

Terrible idea in git

Jan. 26, 2016, 6:52 p.m.

Preserving Corey Quinn's terrible idea in Git for posterity

# new git repo
git init
# let's look at what's under the .git directory
cd .git
ls
# files! let's version control them
git init

C++ implicit conversion

Oct. 23, 2015, 12:34 a.m.

Given:

struct Wat {
    Wat(int i) {};
};
void foo(Wat w) {};

C++ allows you to do:

foo(1);

C++ will use the constructor to create the object upon invocation. This is called implicit conversion, a better name for which should be Completely Unexpected Default C++ Behavior #827125. I did not know about this until an interviewer recently asked me about the explicit keyword, which is used to suppress this implicit conversion behavior.

Much palms were faced.

Alphabetical ordering

Sept. 20, 2015, 12:18 p.m.

Where I worked this summer, there was a rule to always alphabetize related lines before sending the changes off to a code review.

This is bad:

  doVenus()
+ doMercury()
+ doMars()

This is good:

+ doMars()
+ doMercury()
  doVenus()

I would agree wholeheartedly if that's simply the code style of the project, in same the way that public methods should go before private methods, etc.

However, the first reasoning I was given was that alphabetizing changes reduces conflicts in a three-way merge. Certainly this has nothing to do with the diff algorithm that git uses (usually Myers, which deals with longest common subsequences, not text content). The intuition is probably that alphabetizing provides the opportunity to spread additions throughout the file, rather than confining them to the end where every change is a conflict. Then the question is, would alphabetizing still be better than random placement of lines? Intuitively, probably so, but I don't see any studies measuring this. For now, I'll chalk it up as "possibly useful voodoo", like most software engineering techniques are. ;)



newer << Page 2/6 >> older