Design Article
A funny thing happened . . .
Jack Crenshaw
12/1/2008 12:00 AM EST
A funny thing happened on the way to this column. If you're a regular reader of Programmer's Toolbox and have been following my series on C++ classes for vector and matrix algebra, you may have wondered why you haven't heard from me lately. The reason: I got sick. Real sick. As in, two weeks in hospital sick.
At the time, I had three columns in the works: two Embedded.com online columns and one for the special November issue of Embedded Systems Design. I was working hard to get them out, but was fighting general feelings of weakness, dizzy spells, and shortness of breath. My wife was urging me to see a doctor, but I said, "Not until my columns are finished." I mean, am I devoted, or what?
In the end, though, I couldn't even manage to sit in the chair typing. After one full day in bed, I gave it up and called 911.
I won't bore you with the details, and I promise not to show you my scars. But just to put any grim speculations to rest, we discovered two serious but fixable problems. First, I had developed adult-onset diabetes, which "onsetted" quite suddenly and unexpectedly. Second, I had blood clots in both lungs, each the size of Arizona.
Fortunately, diabetes is easily controlled with diet, exercise, and/or insulin. As for the blood clots, they apparently didn't come from any systemic problem, and the doctors have me on blood thinners and assure me the clots will dissolve in time.
For reasons I can't begin to imagine (except Divine Intervention), I feel surprisingly good. I've lost about 60 lbs. For someone who's not supposed to be able to breath at all, I haven't noticed any shortness of breath. In fact, the more strenuously I exercise, the better I seem to breath. How does that work?
So that's my excuse. The clots ate my homework. Now let's get back to business.
More on reuse
In my last column, I mentioned a problem I was having with Microsoft Visual C++ Express 2005 (VCX). Since it's been awhile, let me recap the situation.
With VCX, you don't build programs, you built "Solutions" and "Projects." By default, VCX installs itself in your My Documents folder, and puts all projects in a folder called ..My Documents\Visual Studio 2005\Projects. Each project gets its own subfolder below that. When I first began developing the vector and matrix classes, I went along with this strategy. I created a project for the vector class and its test driver, and a second project for the matrix class and its test driver.
Later, however, I decided to rearrange things. I tend to keep all my source files in separate folders, one for C, one for C++, etc. Further, I keep the truly reusable source files in a library folder, unimaginatively called jlib. Since the vector class is used in the matrix class, keeping the source files in separate folders makes no sense.



xorbit
12/9/2008 12:12 PM EST
Good to hear you're feeling better and are back in action.
Your fight with VCX is a nice example of how Microsoft software tends to get in your way instead of helping you to get your work done. After all, they know what's good for you better than you know it yourself, right?
I hope the Microsoft fellow can help you figure it out. If not, there are other alternatives that are more inclined to let you do what you want. Oh, I forgot, you like to put Microsoft extensions like "#pragma once" in your headers. I guess you're stuck with them then. Maybe standard C preprocessor guard cruft wouldn't be so bad after all?
Sign in to Reply
DinosaurForHire
12/11/2008 8:16 AM EST
After working with Microsoft tools, I've come to the conclusion
that they want to remove any interaction between the user and
the directory structure. They want to completly control how we
save our data to the harddrive.
The Visual C++ tools are very powerful, but they have many little
quirks that get in the way. Many times, when I copy a VC++ project
from the web onto my own computer, I spend hours trying to get the
directories and library links straightened out.
After I get a sample project working, I would like to be able to
"clone" the project to another directory and rename the files to
match. Does VC++ do that? NO! I have to start over with the
wizzard and they copy over all the files from the old project.
Then, I have to rename the files to fit the new project name.
Please Mircosoft, let me make a new project that is the same as
another project, but just a little bit different.
Sign in to Reply
Bill E
8/20/2009 7:29 PM EDT
Not only does PC-Lint catch this, which I've made the habit of running before EVER executing a test, but plain-old GNU CC catches it as well, assuming that you're compiling with the "-W" (show warnings) flag enabled:
warning: comparison of unsigned expression >= 0 is always true
Even when not running Lint, I have my C/C++ compilers set to have the most aggressive warning level I can stand.
Sign in to Reply