Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Database

Going Undercover


Jul00: C Programming

Al is a DDJ contributing editor. He can be contacted at [email protected].


I've been to a lot of computer software conferences. The one I'll tell you about today was not much different than most. This particular conference occupied most of the convention meeting space of a large resort hotel in a nearby large city. It boasted the usual showroom floor with flashy booths featuring the big names in networking systems. In the hallways, the usual gaggle of intense young people scurried about on important missions in blue jeans and T-shirts, wearing name tags, laptops slung over their shoulders, cell phones glued to their ears.

I was undercover on what turned out to be an investigative journalism assignment.

My role at such shindigs is often that of speaker or book signer. Sometimes I am there as a member of the trade press to cover the event for Dr. Dobb's. Because of the public persona this column provides, I enjoy a small amount of celebrity, and many programmers know me and what I look like. But since everyone at a trade show looks at everyone else's name tags anyway, my name and the Dr. Dobb's logo usually bring instant recognition even when my face does not. When that happens, programmers accost me, wanting to discuss some point I made in a column or book; marketers rope me in, wanting me to buy my lunch and show me their latest wares; and session attendees circle around, wanting to discuss whatever methodology, opinions, or other snake oil I pitched at them. The price of fame.

This conference was no different than the others except for me. I wasn't dressed casually, like a programmer, like I usually dress. I was in a tuxedo and looking good. But with no name tag, I couldn't even get past security onto the showroom floor. You see, I wasn't a conference participant or attendee much less an industry celebrity. I had a different role, and even though I have the same face, no one recognized me, or even looked at me. I might just as well have been one of the hotel waiters, who wear tuxes, too -- the uniform of the nondescript. Incognito. Wallpaper. Father of the bride.

At first, culture shock set in when I realized that nobody knew me. That expected faint glimmer of recognition followed by that furtive glance at my badged bosom never happened. Even a couple of people whom I thought I recognized from other shows looked right through me. I was just another hotel employee in an ill-fitting tux, someone of no more consequence than a potted palm. Being ignored is not easy when you are accustomed to recognition, but this time, it turned out to be an advantage.

How did this reversal of roles come to be? Simple. I didn't know I was going to a software conference. I was booked to play the piano at a private dinner party across the hall from the showroom. My other life, you see, is that of a saloon and salon piano player. Which explains the penguin suit and the absence of conference credentials. Which is how I wound up undercover.

My assignment, if I chose to accept it (I always wanted to say that), was to play background piano music in a private dining room while important computer people wined, dined, schmoozed, and gave speeches. During the speeches, naturally, I stopped playing and sat quietly at the small grand piano, blending into the ambiance, but paying careful attention. Eventually, a chance circumstance provided the opportunity for me to exploit this anonymity and go out in the cold.

The dinner's hosting company, a prominent old-economy megacorporation that mostly makes hardware, was courting a prominent new-economy company that mostly makes software, to effect a joint venture to combine technologies and marketplaces and achieve some greater good for both companies. Dinner, booze, and piano music par excellence are supposed to bring people together, I suppose. I guessed that most of the folks at this soiree were marketing representatives with a smattering of management suits to give the obligatory speeches and maybe authorize any deals that might go down. I guessed who they were based on the party game they played and their speeches.

For entertainment, the hostess ran an audience participation guessing game. She'd pose a technical question to the group, and whoever gave the correct answer first got a T-shirt. Most of the questions were really dumb. Most of the people did not know the answers, and few T-shirts were given away, which is why I think they were marketing and management types. At first, I was struck by the irony. How would they react if, after their best and brightest flunked each test, the wallflower piano player who looked like a busboy in a ratty tux blurted out the correct answer? I resisted the impulse. I would have had about a dozen T-shirts to take home to Judy, but it would have blown my cover.

I stayed under wraps for good reason. Early on, a high-ranking official of the hosting company gave a speech intended to convince the software people that the marriage being pitched was a good one. During one particularly dramatic moment in his presentation, he looked from side to side and made some point in a lowered tone obviously meant to convey that this was an off-the-record comment not for publication. Then, to emphasize that he was letting them in on something juicy, he added, "...which is why the press was not invited this evening."

Two waiters and a bartender hurried out to call their brokers.

For purposes related to the covert nature of my assignment, I cannot reveal the name of either company. I can, however, provide an encryption of the name of the host company -- whose three-initial logo is instantly recognizable to all -- in the form of this cypher: 0x0840. A free Dr. Dobb's T-shirt awaits the first reader who not only identifies the company but also explains the meaning of the cypher. Employees of DDJ and piano players are not eligible.

Gcc, VC++, and the Standard C++ Library

In May, I reported the result of some small benchmarks I conducted involving the Mingw32 port of the gcc 2.95.2 compiler and Visual C++ 5.0. Examples 1 and 2 are the source code for the two programs. The purpose of the comparisons was to compare build times and executable sizes for two nearly identical programs for both compilers. One program uses the legacy iostream library that predates Standard C++, and the other program uses the Standard C++ Library. Gcc has available only a recently released preliminary, experimental version of a Standard C++ Library. The Visual C++ Standard C++ Library is not fully compliant either but has been available for several years.

These comparisons generated a lot of mail. Several readers compiled the programs by using the GNU/Linux port of the gcc compiler and reported much different results from my own: Their compile times and executable sizes were much more favorable than mine. Each reader drew his own conclusions from his experiment, some wondering about the efficiency of the Mingw32 gcc port and others wondering about my credibility as a compiler reviewer. To a man, however, they each made the same mistake -- they compiled the programs by using the same command-line syntax. When you do that, the two programs are virtually the same. Here's why.

For several years gcc, not having a Standard C++ Library, emulated what the committee was defining and has now approved. When you include a Standard C++ Library header, such as <iostream>, gcc provides a header that includes, directly or indirectly, the legacy header, for example <iostream.h>. Most of what a programmer does with the standard iostream classes works with the same syntax used by the legacy iostream classes, which is why the ruse works. When a program references the std namespace by default, gcc just ignores the reference. Consequently, both my benchmark programs compile the same with gcc, and both use the legacy library.

All the readers who ran their own benchmarks against my programs and sent me the results made the same omission. They neglected to use the experimental Standard C++ Library. That might be because I neglected to explain that you must take special measures to do that. To use the new library, you must get a version of it that includes the headers and library file compiled for your platform. Then you must tell gcc to search for system headers and library files in the new library's paths rather than the default paths, which contain the legacy library stuff. Finally, you must include the command-line option that tells gcc to properly process the std namespace wherever it appears in source code. Something like the command line in Example 3.

Notice the -s command line option in Example 3. Ithier de Lestrange told me that -s tells the linker to remove symbolic and relocation information, which results in a smaller executable. The gcc command-line option documentation confirms that -s does what Ithier said. I tried it and it worked. Table 1 shows the sizes of the compared executables revised to show what happens with the -s command-line option. (In May's table, the first two values under "Size of Binary" were 166,516 and 1,211,539 -- significant differences.) This effect surprised me. I do not know why a linker would find symbolic information in object files compiled without debugging information unless, of course, the experimental C++ Standard Library is distributed with debugging information included. Another reason might be that the option refers to symbolic information related to unresolved external identifiers, which would make more sense. That assumption notwithstanding, I do not understand why a linker would, by default, leave relocation information in an executable file when all the relocatable symbols have been resolved. Perhaps someone who understands this process better than I do will provide the answers.

A few readers questioned whether it is valid to compare the sizes of binaries compiled by different compilers when there are other variables to consider. For example, Mark Whitehouse ran the VC++ executable against the Dependency Walker utility and found that the VC++ executable, which is smaller, depends on two Win32 DLLs (kernel32.dll and ntdll.dll), whereas the gcc-Mingw32 compiled binary, when run against the ldd utility, shows no such dependencies. Some of the difference in sizes could be attributed to VC++ offloading onto its DLLs code that gcc statically links. Several other readers made similar suggestions.

The truly telling measure, however, is the length of time it takes gcc to compile a program that uses the Standard C++ Library. That metric has not changed since May.

Open Source

I used my comparisons in May to pose some rhetorical questions about the open-source initiative. This is not something you want to do in a casual manner. People who believe in open source are zealous to say the least, and when someone outside the movement asks questions, the wagons circle and a few flames spew forth. I'm always suspicious of anything that can't, or refuses to, bear up under a few questions. My current skepticism is based on the numbers in Table 1, even with this month's revisions, and the length of time it is taking for open-source volunteers to complete their Standard C++ Library when compared to similar commercial efforts.

My skepticism is not meant to be critical of the dedicated work of volunteer programmers. To the contrary, I am impressed by their achievements and often state publicly my gratitude for their work. After all, I distribute open-source compilers with books about C++ and don't have to pay for them. This paragraph will, no doubt, be ignored in the e-mail I get about this column.

Open DDJ

DDJ is based on giving away source code. The magazine has been doing it since 1976, long before there was an open-source movement and even before there was a Free Software Movement, discussed a few paragraphs down. That part is overlooked when the flames come in. Consequently, I do not respond graciously when someone preaches to me about some innovative new software-distribution model that centers on giving away source code. DDJ invented the concept. Years ago.

Open Al

In books and this column, I have contributed hundreds of thousands of lines of source code to the public domain. The difference between my free source code and that of other initiatives is that I attach no strings and include no licenses, which means that anyone can use my code to build a commercial product, owe nothing to me, and have no obligation to distribute their derived source code to anyone. For one example, a major computer company recently released a software product for hardware testing that uses at its core the C interpreter I published in this column as Quincy 4.1. I get no royalties and want no credit. No blame, either, when something doesn't work.

I don't advance my software-distribution model as one that anyone should adopt. It works for me because I get paid to write and publish the programs. Not everyone has such a forum. I don't attach strings because I don't want to enforce licenses or expend substantial effort supporting the stuff. I give source code to programmers who ought to be able to make it work the way they want it to work. I hope you make a million bucks with my code.

Open Source and the Free Software Movement

Which brings the Free Software Movement into the equation. Although DDJ was a pioneer in freely distributing source code, the Free Software Movement, organized 16 years ago, was the first to formalize the practice in a manner that involves a license and imposes certain restrictions on those who partake of the software offered for free under that license. Their purpose has social undercurrents.

A certain amount of confusion has evolved about the difference between the open-source movement and the Free Software Movement. I have been as confused as anyone. My writings and e-mail exchanges about the GNU C++ compiler prompted Richard Stallman, the founder of the Free Software Movement, to try to clear some things up. The quotes that follow come from messages that Richard sent in response to questions I asked. The exchange was extemporaneous, so I organized the quotes not in chronological order but according to the subject at hand.

Richard said:

...GNU C++ has nothing to do with "open source." It was developed by the Free Software Movement, like all the rest of the GNU software...The Open Source Movement was formed in 1998 to advocate more or less what we were already doing, but discard the philosophy behind our work.

You can read about the Free Software Movement's philosophy at http://www.gnu .org/philosophy/free-sw.html. Richard went on to say:

Where we raise issues of a political, social, and ethical nature, talking about freedom and community, they studiously avoid these issues and raise only practical concerns.

When I suggested that Richard might not mean to imply that the goals of the Free Software Movement were impractical, he answered:

Freedom and community are not mere practical concerns, but they are not "impractical" -- that is a different question.

Political, social, and ethical issues have great effects on people's lives, which is what make them important. However, for an individual they are not specifically practical concerns.

For Richard's comparison of "free software" and "open source" read http://www .gnu.org/philosophy/free-software-for-freedom.html.

In response to a reader who suggested it is unfair to compare GCC, an open-source compiler, to VC++, a proprietary development tool, Richard said:

...I think it is reasonable to compare GCC with other compilers on any platform which it supports, including non-free platforms such as Windows. People who are deciding which compiler to use on Windows will be interested in how the compilers compare on Windows.

In doing this comparison, I hope you considered not only performance but other dimensions also. For example, there is the dimension of "What are you allowed to do with the program?" VC++ is a proprietary program, so users are basically restricted to doing nothing except running it. For GCC, users are allowed to study how the compiler works, and either make changes or commission changes. If they find a bug, for example, they do not have to wait for the next upgrade and see if it is fixed. They can look around for someone to hire who will fix it on the double. Microsoft cannot match the support that the Free World provides for free software.

I did not consider those other dimensions in my discussion and thank Richard for pointing them out. When we discussed the original goals of GNU, Richard said:

The goal of GNU was, of course, to be a complete replacement for UNIX.

When I asked if Linux was a result of the GNU goal, he answered:

People are confused because of a confused and erroneous use of the term "Linux."

Linux, properly speaking, is the name of the kernel that Linus Torvalds wrote in 1991. I doubt that GNU was a major inspiration, because he did not write it with the intention of making it free software. (I think he did not expect people to use it.)

Linus decided to make the kernel free software after he had it working. In that decision he was surely influenced by the GNU Project, since he chose the GNU GPL [General Public License] as the license.

When people speak of the "Linux operating system," they are referring to a combination which is basically the GNU system, with Linux used as the kernel. The GNU Project is the principal developer of the system, but most of the users do not know this, because the name "Linux" gives people the idea that it has nothing much to do with us. That you had to ask whether this system is the result of our goal illustrates how that name can mislead people.

He then requested that I use the name "GNU/Linux" and referred me to http:// www.gnu.org/gnu/linux-and-gnu.html adding:

This will also help your readers understand clearly the difference between the kernel and the whole system. It is hard to learn the difference between two things when they are called by the same name. See the linux-kernel FAQ, http://www.tux.org/lkml/ index.html#s1-1.

Breaking Up Is Hard To Do

At this writing, the Justice Department has just recommended to the judge who previously found Microsoft guilty of nefarious business practices that Microsoft be broken into two companies, one to do Windows and one to do applications software. Which means I'll have to don the old disguise once again and go out into the cold in search of the truth. To be continued next month...

DDJ


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.