It's always instructive to crank the warning level up on compilers. It
also helps to use different compilers since they tend to warn about
different things. With GCC, I use
sadly, isn't all
possible warnings) but today I learned that clang (the default compiler on Mac OS-X
these days) has a
-Weverything option, so hey, why not try
It's not kidding—it warns about everything! Missing prototypes, gratuitous use of packed structures, added padding to structures, signed conversions (not only unsigned to signed, which I can see possibly losing information, but signed to unsigned, which doesn't), loss of interger precision, relying on auto-conversion of function calls (in my case, assigning the result of a function that returns a double to an unsigned long long variable), alignment changes in unions, even “default label in switch which covers all enumeration values.”
It's a lot of output to pour through. And this is for code that passes cleanly through GCC.
But in the ton of “legal, even if a bit questionable C” it still managed to find a real bug in my code:
In file included from common/XXXXlib.c:11: third_party/uuid/src/uuid.h:34:17: warning: 'SHORT_MAX' is not defined, evaluates to 0 [-Wundef] #if RAND_MAX == SHORT_MAX ^
It's a typo—it should be
SHRT_MAX (apparently, there was a
severe shortage of vowels in 70s computing, which is why C got stuck with a
bunch of vowel-impaired identifiers—sheesh!) but at the same time, it's
perfectly legal C, which is why I never noticed this until now.
Last week, I initiated a return of the video card with Amazon. I stated my reason for returning it:
I received an ATI Technologies Inc RV370 [Radeon X300SE], which works, but is not what I ordered.
and I was informed that I should hear back from the third party company I ordered the video card from in less than 48 hours.
Nearly a week later, and I had yet to hear back.
I logged into Amazon to lodge another complaint when I stumbled across the message the third-party company sent to me (the following day, on the 21st), along with the error that prevented the email from being delivered:
Final-Recipient: rfc822; Sean Conner <firstname.lastname@example.org> Action: failed Diagnostic-Code: smtp; 554 4.4.7 Message expired: unable to deliver in 840 minutes.<450 <email@example.com>: Recipient address rejected: Service temporarily unavailable> Status: 4.4.7
XXXXXX! Amazon ran afoul of my greylisting daemon (Amazon is acting as a proxy between me and the third-party company—neither one of us has the other's true email address).
Checking the logs confirmed what I suspected happened: every attempt by Amazon to deliver the email came from a different IP address, which caused the greylist daemon to treat each attempt as a separate email and thus, block each attempt.
Once that was cleared up, I got the story as to what happened. The third-party company had run out of the video card I requested, and since the card they sent contained the same connectors and amount of memory, they felt it would be acceptable. Had I the right drivers, it might have been acceptable. But I didn't, so it won't.
The third-party company apologized for sending the wrong card. They also said they just received a new shipment of the video card I did order and they're sending one to me. All I need to do now is return the original card they sent back once I get the right card.
So … round three!
We shall see how this goes …
… his phone rang with an old-fashioned warning: “You don't know it, but you're in trouble.” A group was planning a takeover of the county, said the caller, a woman in Arizona who promised to send him some information by e-mail. The material described the plans of a Libertarian faction in its own words “to win most of the elected offices in the county administration” and “restore to freedom” Loving County.
The goal, said an e-mail message attributed to a group member, was to move in enough Libertarians “to control the local government and remove oppressive regulations (such as planning and zoning, and building code requirements) and stop enforcement of laws prohibiting victimless acts among consenting adults such as dueling, gambling, incest, price-gouging, cannibalism and drug handling.”
Now pictures of the three decorate a poster on the sheriff's door at the Loving County Courthouse under the timeworn Wild West legend: “Wanted by the Texas Rangers.”
Oh real life! You are so much better than satire these days.