Filed under: Programming — Answers 2000 @ 11:46 am
There’s some good uses for the C preprocessor, for example, conditional compilation, and the assert macro.
But there’s some horrible abuses. The worst abuse of all?
That’s a hard one, particularly when some people deliberately write unreadable programs, but I think one of the worst ones in the real world, are those people who redefine the C language using the preprocessor, and try to turn it into a non-standard version of Perl, Pascal, Basic, or whatever their particular favorite language is (one example here - yes that is the UNIX Bourne Shell, really).
If you’re going to do that, why not go the whole hog:
#define ONE (1)
#define TWO (2)
#define THREE (3)
#define FOUR (4)
#define FIVE (5)
/* etc */
#define PLUS +
#define MINUS -
#define MULTIPLIED *
#define DIVIDED /
#define BY
#define WHAT int main( int argc, char * argv ) { printf( “%d\n”,
#define PLEASE ) ; return 0 ; }
#define IS
Now you can write programs like this:
WHAT IS FIVE MULTIPLED BY THREE PLEASE
or
WHAT IS FOUR DIVIDED BY TWO PLEASE
In short: if you don’t like C, and wish it was Pascal or Basic or Cobol, then why the heck are you programming in C?
The last time I used a Mac seriously, Rick Astley was in the charts. I don’t have anything against Macs, but until recently I’ve never considered getting one - until recently. Why no Mac? I’m a programmer, and I’d always figured it too darn hard to write cross-platform (Windows and Mac) software, particularly when the Windows market is so much bigger.
Recently I came across BlitzMax, and it seems to offer the possibility of writing sophisticated apps, without all the usual hassles (unlike say C++), and with the full native look and feel on each platform (unlike Java). The nice thing about BlitzMax, is it supports Windows, MacOS and Linux.
I can’t currently justify buying a whole new computer just to run MacOS, particularly since I don’t have any firm plans for cross platform apps yet. But, one other potentially important thing has happened recently… Apple has switched to Intel CPUs (although when I went to the computer store today, most of the Macs there still seemed to be PowerPC).
Are you thinking what I’m thinking?
I’ve been thinking it for a while…. it ought to be possible to have a triple boot machine, Windows, MacOS, and Linux all on one box.
Well it sounds like somebody has figured out how to do exactly this kind of triple boot, but when I read the details of the setup involved, my heart sank. It sounds complicated, and I’m guessing it may be that setting up triple boot is beyond somebody who isn’t familiar with all the obscure corners of Mac set-up lore. I hate fiddling around with computer set-ups (I just want to use and program the darn machines), and I’m kinda concerned that if I bought a Mac, I might simply be incapable of getting it to triple boot, or worse yet, trash the hard-drive.
So, Steve Jobs if you’re reading… your first decent chance to sell me a Mac in 20 years - start selling Macs that are already set-up to triple boot. And a side benefit: you’ll get my new apps, whenever they’re ready, running on your OS too.
A news story about McAfee got me thinking. According to the headline used, McAfee, said “Open-source encourages rootkits” (a rootkit is software for getting backdoor, usually unauthorized, access to people’s computers).
At first, I was just bowled over by the bizarre headline. Open-source is both a development methodology, and a set of copyright licenses (such as the GPL or BSD license) for various works - and is used for a whole variety of different products, such as Linux (operating system), MySQL (database), Firefox (web browser), even Word Press (blogging software, as used for example, on this site), etc., etc.. And I couldn’t see that you can draw any connection between such a diverse set of products, and rootkits - especially when it’s probably fair to say that most rootkits are squarely aimed at taking over Windows PCs, and get on to Windows PCs via security holes in Windows or Internet Explorer (both of which are of course firmly not open-source).
If I stopped writing now, my blog post would read like the typical techie rants that you might find on Slashdot, but then I actually read the article…
It seems the headline doesn’t properly reflect the content of the story… you might say it’s been sexed up. The story is about a report by McAfee (which I haven’t seen and which isn’t quoted in the article), which seems to be making a different point. McAfee does not appear to be saying “Open-source encourages rootkits”, but rather appears to be saying “Open-source rootkits encourage rootkits”. When read this way, the point changes entirely, and now we can actually have a proper debate.
Here’s the basic argument of the two sides of such a debate:
Position: Open-source* rootkits encourage malicious people to use rootkits
(I’d guess that this is probably something like McAfee’s argument, although, as I say, I haven’t actually read their report)
Argument: Any malicious person who wants a rootkit, can download an open-source rootkit, possibly modify it to their requirements, and then go on their malicious way. The fact that the tools are so widely available, may encourage people to act maliciously who otherwise either wouldn’t have been tempted to, or wouldn’t have had the technical capability to do so.
Position: Open-source rootkits can help better build better security
(Argued for by Trend Micro in the article)
Argument: Open-source rootkits allow security researchers to study these types of software, and thus devise better defenses.
* I’m pretty sure the argument, is really addressed at “freely downloadable rootkits with source code”, rather than “open-source”, and the fact that something might be licensed under an open-source license, is actually pretty much irrelevant (both to the malicious person who probably isn’t going to care about violating licenses/copyrights anyway, and to the particular argument used) - but let’s not get bogged down in semantics
Who is right?
I can’t say, in fact it doesn’t seem to me that there is any contradiction at all between the two positions - both surely have some element of truth in them - and the two sides are talking past each other.
But here’s a thought (and I know this, like all analogies, is an imperfect analogy): Imagine that instead of rootkits, we were talking about being able to download a instructions for building WMDs in your garage, using bits of old wire and coathangers (and these instructions actually worked) - would society want restrictions placed on the circulation of this dangerous knowledge?
I don’t have the answers - but I do have an awful lot of questions:
Are rootkits dangerous knowledge?
Should society try to place restrictions on the circulation of dangerous knowledge?
Would any such restrictions be effective? (n.b. effectiveness isn’t necessarily measured on a binary scale!)
Where and how does freedom of speech fit into all this?