RSSAmplifier

Blog

Confessions of a Wall Street Programmer

btorpey.github.ioRSS feed ↗20 posts

Latest posts

Danger, Will Robinson!

I’ve recently been dipping my toes in the very deep water that is “undefined behavior” in C and C++, and the more I learn about it, the scarier it is. This was inspired by a rather tricky crash that I needed to track down as part of moving the code-base at my day job to more modern compilers and language standards. Compiler writers have been getting more agressive about taking advantage of…

Moving from CentOS to Ubuntu

I recently needed to build a Linux development system from scratch, and while I was at it I decided to provide dual-boot capability between CentOS and Ubuntu. Having used RH/CentOS pretty much exclusively since moving from Unix (Solaris) to Linux many years back, I learned that even though CentOS and Ubuntu are both Linux, they are very different in ways both large and small. I shaved a few yaks…

Memory Checking

At my day job, I spend a fair amount of time working on software reliability. One way to make software more reliable is to use memory-checking tools like valgrind’s memcheck and clang’s AddressSanitizer to detect memory errors at runtime. But these tools are typically not appropriate to use all the time – valgrind causes programs to run much more slowly than normal, and AddressSanitizer needs a…

Lots o' static

OpenMAMA Following along False Positives Style vs. Substance Dead Code Buffer Overflow NULL pointer dereference Leaks Pointer Errors But Wait, There’s More! Conclusion Footnotes I’ve written before about static analysis , but in those earlier posts I wasn’t able to give specific examples of real-world code where static analysis is able to discover latent errors. In the earlier articles I used a…

We Don't Need No Stinkin' Databases

I’ve been working on performance analysis recently, and a large part of that is scraping log files to capture interesting events and chart them. I’m continually surprised by the things that you can do using plain old bash and his friends, but this latest one took the cake for me. Did you know that Linux includes a utility named join ? Me neither. Can you guess what it does? Yup, that’s right – it…

Even Mo' Static

TL;DR Methodology ITC test suite Caveats Specific issues Real-world test results False positives Conclusion Appendix: Helper scripts and sample results Appendix: Detailed test results A while back I wrote an article that compared cppcheck and clang’s static analyzers (clang-check and clang-tidy). The folks who make PVS-Studio (the guys with the unicorn mascot that you’ve probably been seeing a lot…

Custom-Tailored Configuration

As developers, we seem to take a special delight in personalizing the virtual worlds in which we work – from color palettes to keyboards, fonts, macros, you name it. “Off-the-rack” is never good enough, we want Saville Row tailoring for our environments. And a lot of the tools we use support and encourage that customization, giving us control over every little option. But not every tool we use…

Mo' Static

Testing Static Analysis Tools Can I haz teh codez? Creating a compilation database Establishing a baseline Using clang’s analysis tools Analyzing the results Running clang analysis (again) Using cppcheck Installing cppchceck Verifying the installation Running cppcheck Analyzing the results Comparing clang and cppcheck Conclusions Acknowledgements References In my day job, one of my main focuses is…

Remote Scripting with bash and ssh

Nowadays it’s pretty common for applications to be distributed across multiple machines, which can be good for scalability and resilience. But it does mean that we have more machines to monitor – sometimes a LOT more! Read on for a handy tip that will let you do a lot of those tasks from any old session (and maybe lose some of those screens)! For really simple tasks, remote shell access using ssh…

Static Analysis with clang

I keep singing the praises of clang, and with good reason – the clang project has been advancing the state of C/C++ compiler technology on Linux and OS X for quite a while now. The modular design of the compiler has also enabled the creation of a set of ancillary tools, including run-time “sanitizers” (which I wrote about earlier ), as well as pretty-printers, and a tool to automatically upgrade…

Who Knows What Evil Lurks ...

Pity the poor Shadow! Even with the recent glut of super-heroes in movies, games and TV, the Shadow is nowhere to be seen. But I guess that’s the whole point of being the Shadow. According to this , the Shadow had “the mysterious power to cloud men’s minds, so they could not see him”. Hmmm, that sounds like more than a few bugs I’ve known. Read on to learn how to get your compiler to help you find…

Building clang on RedHat

clang is a great compiler, with a boatload of extremely helpful tools, including static analysis, run-time memory and data race analysis, and many others. And it’s apparently pretty easy to get those benefits on one of the supported platforms – basically Ubuntu and Mac (via XCode). That’s fine, but if you get paid to write software, there’s a good chance it’s going to be deployed on RedHat, or one…

Into the Void

I keep reading talk of the sort “I don’t know why anyone bothers with C++ — real programmers use C. C++ is for wussies”, or words to that effect. Well, a while ago I had to go back to C from working exclusively in C++ for a while, and I have to say that I think the C fanboys are just nuts. The project I’m referring to involved packaging up NYSE’s (now SR Labs’) “Mama” middleware so it could be…

Repent, Sinner!

When I was a kid I went to Catholic school, and back in those days the nuns would indeed rap your knuckles with a ruler if you misbehaved. That doesn’t happen so much any more, but when I see someone making use of the copy-paste anti-pattern , I’m tempted to reach for a ruler myself. (I know, probably not a good career move ;-) Short of rapping someone’s knuckles with a ruler, though, how do you…

Status Meetings

One of the banes of corporate life is the status meeting. It would be nice to get rid of them, but then it would be nice to get rid of all the lawyers too 1 , and I don’t see that happening either. So, how do we make them better? Well, for starters we could make them shorter. Here’s a way to do that. I’ve had two really good managers in my career (although I have no idea whether that means I’ve…

Guess What Day It Is!

No, not that – it’s Perl day. (Well, actually it’s just Wednesday, but you get the idea). Sometimes it seems that everybody likes to hate on Perl, but I think their animus is misdirected. It’s not Perl that’s the problem, it’s those \^\$(.#!)?$ regular expressions. Or, as Jamie Zawinski once said “Some people, when confronted with a problem, think “I know, I’ll use regular expressions.” Now they…

Where Am I?

From Robinson Crusoe to Gilligan’s Island to Lost , tales of being stranded on a desert island seem to resonate with people in a special way. Some of that likely has to do with the exotic locales, and the practical challenges of getting water, food and shelter. But an even more basic part is the unanswered question: “Where am I?” that makes things so – well, mysterious . Shell scripting can be…

Visualizing Latency

I’m a visual thinker (I think I may have mentioned that before ), so when I’m analyzing performance, latency, etc. I find it really helpful to be able to visualize what is going on on the machine. As a result, I had gotten reasonably good at using Excel to produce charts, which sometimes helped to correlate observed behaviors like latency spikes with other events on the machine. For a bunch of…

A Picture is Worth 1K Words

You know those mutiple-choice tests that put you in one of four quadrants based on your answers to a bunch of seemingly irrelevant questions? We’ve all taken them, and if you’re like me they’re kind of like reading your horoscope – it all seems so right and true when you’re reading it, but you wonder if it would still seem just as right and true if the horoscopes got jumbled at random? Well, I…

Using clang's Address Sanitizer (without clang)

Valgrind has been an indispensable tool for C/C++ programmers for a long time, and I’ve used it quite happily – it’s a tremendous tool for doing dynamic analysis of program behavior at run time. valgrind 1 can detect reads of uninitialized memory, heap buffer overruns, memory leaks, and other errors that can be difficult or impossible to find by eyeballing the code, or by static analysis tools.…