Tuesday, September 28, 2004

Breadth is sometimes better than depth

Eric Lippert talks about how you usually use recursion to list all the files in a directory and how to change your code to make this iterative (with an explicit stack).

Recursion just lets you do this algorithm without making the stack explicit; the stack is the call stack and doing the recursive call pushes a new frame on the call stack for you. We can easily do this without recursion by making the stack explicit.

Its written in some language that is called "CoffeeScript" or "Java" or something like that, but if you catch the drift, you should be able to use it in any language. And he continues to show how to change the behaviour from depth-first to breadth-first.


Monday, September 27, 2004

From CodeWarrior 9.2 to XCode 1.5

This one comes from the darwin-development mailling list (Email address of Brad Oliver changed).

-------- Original Message --------
Subject: CodeWarrior to XCode
Date: Wed, 25 Aug 2004 23:59:53 -0700
From: Brad Oliver
To: darwin-development@lists.apple.com
CC: xcode-users@lists.apple.com
References: <20040826050031.5453.61096.mailman@lists.apple.com>

> Brad,
> is not that you have written an internal document - say -
> "How To's with Xcode: quirks explained" that could be distributed?

I haven't written anything more formal than an e-mail to my colleagues about the process. I'll summarize below. A lot of the "quirks" are not so easy to quantify as they involved getting used to the XCode IDE, which behaves very differently (to my eyes) compared to CodeWarrior.

Note that my perspective here is coming from years of work using CodeWarrior and porting code from Visual Studio to CodeWarrior. Also, these notes come specifically from our work moving Knights of the Old Republic (KOTOR) from CodeWarrior 9.2 to XCode 1.5.

1. "legacy" for-loop scoping (a variable defined in the for loop definition has scope outside the for loop) in theory works in gcc, but in practice breaks when the optimizer is enabled. You have use the ISO-standard for-loop scoping rules for this to work, i.e. move the variable declaration outside of the for-loop statement. gcc at least gives you warnings about this, so you can find and fix them in your code fairly easily.

2. Xcode's "CodeWarrior-style" inline assembly only works for the simplest cases, so it's best to avoid it if you can.

3. Passing a non-POD variable (where POD == Plain Old Data, e.g. C-style variables and structures rather than C++ structures that have vtables) to a routine that expects POD variables will generate a warning in gcc, and insert a "trap" instruction into your code, causing the app to abort in the debugger when that code is executed. I have no idea why gcc doesn't just generate an error for this case, since that code will fail to run.

This happens if, for example, you pass a custom string class structure to printf as a %s parameter. Under CW and Visual Studio, they will pass a pointer to the first chunk of non-vtable data (which in KOTOR is the actual char[] backing store for the string class out of blind luck). Under gcc, you must fix your code.

4. With the optimizer set to -O3 (the max), gcc does a lot of auto-inlining. As such, if you have some crappy code where a class defines a method as "inline" but the method is not actually inlined, gcc will give you a link error when you're done compiling. You have to remove the bogus "inline" statement in the function prototype to get it to work.

5. Single-precision floating-point functions like acosf, cosf, etc are not in the standard math library (libm). They are only available in 10.3+, in libmx. A similar situation exists for wchar support.

6. "bool" types are 32-bit in gcc, whereas they are 8-bit in CodeWarrior and Visual Studio. This causes substantial binary compatibility problems with data structures that are read to/written from disk. A "bool8" class can't be used to globally #define the problem away because it causes compile-time issues with templates. However, if you can identify the "bool" data structures that are being read/written to disk, you can change them to the "bool8" class and work around the problem that way.

7. We have routines that override standard library calls at link time, like fopen, etc. ZeroLink causes problems such that our overrides lose out, so it's best for us to keep ZeroLink off.

8. Dead-code stripping has a bug with C++ apps in XCode 1.5 whereby it tends to strip debugging symbols for used functions at link time. The end result is that you can't see the source code for a number of files in the debugger, nor can you set breakpoints in that code. Turning off dead-code stripping for the debug build fixes this, although you may have to work a bit to implement (or comment out) some routines that CodeWarrior would have otherwise stripped away. It's safe to use dead-code stripping in the release builds, as far as I can tell.

9. I write a lot of code that jumps past local variable initialization in C++, like so:

if (bad) goto bail;

int foo = 1;
do stuff here;

This is not allowed by gcc; you have to change "int foo = 1;" to "int foo; foo = 1;". This is only if you're jumping past a local initialization, so it mainly comes up using the Apple debug macros like "require_noerr" and the like.

10. gcc doesn't recognize "\" as a path delimiter for #include statements, you have to change them to "/"

11. If you're using PPC intrinsics (like rlwinm or lhwbrx) you have to be sure to inlude "ppc_intrinsics.h" since they're not natively part of the compiler.

12. KOTOR casts a lot of class function methods as pointers for callbacks. gcc requires that you use a different syntax:

SetCallback ((CallBackPtr) classMethod);


SetCallback ((CallBackPtr) &Class::classMethod);

You can get away with just "&classMethod", but gcc will spew out a warning.

13. Build styles are fairly useless for our projects, since they don't allow us to easily have different libraries and source files for debug and release builds. It's fairly easy to clone XCode targets, so the best solution for us is to ignore/remove build styles from the projects and rely solely on different targets for debug and release builds.

I did run some performance tests on the game when we finished. On my Dual 2.5GHz G5, performance was almost immeasurably slower in the XCode build, by maybe .5 of a frame per second. It was well within the margin of error, enough so that I'd call it even with CodeWarrior.

I had some notes somewhere about compile times, but I can't locate them right now. Suffice it to say, CodeWarrior beat XCode/gcc pretty handily for the non-optimized build, but they were much closer on the optimized build. Surprisingly (at least to me) gcc's compile time using -O3 was almost identical to it's compile time for the non-optimized build. This also carries a big red asterisk - gcc does compile on both CPUs, so if you have a single-CPU Mac (or if CodeWarrior is ever updated to use 2 CPUs), then it's no contest in favor of CW.

I'd appreciate feedback from other people who have had experiences porting code from either VS/VS.NET or CodeWarrior to XCode. In our KOTOR test, the code had already been ported from VS.NET (VC7) to CodeWarrior, so it's unclear to me if there are any advantages that we'd see if we went directly from VS.NET to XCode.

Brad Oliver
darwin-development mailing list | darwin-development@lists.apple.com
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-development
Do not post admin requests to the list. They will be ignored.

If you can program it...

... then somebody will write an OS for it :-)

brickOS is an alternative operating system for the Lego Mindstorms RCX Controller. It also provides a C/C++ development environment for RCX programs using gcc and g++ (the GNU C and C++ cross compilation tool chain) and the necessary tools to download programs to the RCX. If you program in C or C++ and would like to be able to write programs for your RCX in these same languages then brickOS is for you.


IT Jobs


Sunday, September 26, 2004


JOBworld ist eine Metasuchmaschine fuer Stellenangebote im Internet.


Die Suchergebnisse kommen von:
Michael Page
Junge Karriere
Top Arbeitgeber

Friday, September 24, 2004

Hackers and painters

Try to keep the sense of wonder you had about programming at age 14. If you're worried that your current job is rotting your brain, it probably is.


Planet Sun

Just when I thought that MS Blogs are big, I discoverd Planet Sun.

Planet Sun is an aggregation of public weblogs written by employees of Sun Microsystems. The opinions expressed in those weblogs and hence this aggregation are those of the original authors.

Planet Sun is not a product or publication of Sun Microsystems.

Planet Sun is powered by Planet and is run by David Edmondson.

Go an see the list of people blogging. IT IS HUGE.

Do you have any questions for me?

One of the most mysterious questions of any interview is usually the last one asked … “Do you have any questions for me?” Wow. What a loaded question! What do you say? Is it a test? Is it a genuine request for inquiries? Who knows!


MS is not evil - Proof here

Heck, I got quoted in Time Magazine for telling Bill Gates to split up the company. One thing I like about Microsoft is that it likes a diversity of ideas to rumble through the buildings here. The fact that I wasn't fired (or even reprimanded) sent a signal to all the bloggers here that you're welcome to take some risks and make some mistakes.

That is far more freedom that I have at my company. And NOBODY would think about calling them evil (unless they worked here...)


Why it is important that your company has a face

And this face are your employees. All of them.

[Zef Hemel about the MS Blogs]
They have many, many employees of the product teams
blog. This way we can see who work there, what they’re doing and how they do it.


Don’t underestimate the importance of this kind of “marketing”, if you will. I don’t know how other people feel about this, but for me it works very well. For example, if I got to choose between working at Apple or Microsoft, I’d choose Microsoft right now. Why? Because Apple is nothing more than a building to me. Even though they may be working on very great products, arguably more innovative and possibly more interesting than Microsoft’s. I don’t know the Apple people (except for maybe Steve Jobs), I have no idea what the culture is like, I don’t know anything.



World's Smallest Guitar Amp :-)

This will surely not replace any Marshall towers, but it's a nice idea.



PREfast is a static source code analysis tool that detects certain classes of errors not easily found by the typical compiler.


PREfast analyzes C and C++ source code by stepping through all possible execution paths in each function and simulating execution to evaluate each path for problems. PREfast does not actually execute code and cannot find all possible errors, but it can find errors that the compiler may ignore and that may be difficult to find during debugging.


Thursday, September 23, 2004

Wir sind ein Personaldienstleister

Die RKM Zeitarbeit GmbH hat mich angeschrieben und wuerde gerne einen Lebenslauf von mir haben :-)

Ich hatte bisher sowohl negative als auch positive Erfahrungen mit Zeitarbeit/Personaldienstleistern. Ich werde mich mal bei denen melden und schauen was die so zu bieten haben. Nicht das ich viel erwarte, aber einfach mal schauen kostet nichts.


Man Plans, God Laughs

And I would say that if the success of your project depends on your ability to forecast the future to that degree of precision, you're doomed from the outset . . .


Wednesday, September 22, 2004

Tuesday, September 21, 2004

Verifying that your system files are digitally signed

Larry Osterman points out the tool sigverf, which verifies that "the files on your system haven't been tampered with".


Apple Technical Note: Kernel Core Dumps

Technical Note: Kernel Core Dumps


So sad

A couple of weeks ago, our company forbade everybody to get SP2 for XP and DISABLED automatic Windows Updates.

Of course, this means, that nobody has the MS Patch for the JPEG vulnerabiltiy...

Maybe somebody will wake up, when their computer was rooted and all company secrets have gotten to the competition. But than again, maybe only the unlucky person whose computer has been rooted will be fired (and not the person responsible).

Auswahl an online Jobboersen

http://www.stepstone.de (Inkl. Anzeigen aus der Welt)

Larry Osterman's WebLog

Everybody interested in one of the following topics should read Larry Osterman's WebLog

- Microsoft History
- Windows Audio
- Microsoft Exchange, and email in general
- The Win32 APIs, but not the Win32 GUI APIs
- Software engineering
- Debugging tricks and tips
- Security
- COM, DCOM, RPC, etc
- .Net framework
- Localization/Internationalization issues


Thursday, September 16, 2004

Saturday, September 11, 2004

Cooking For Engineers

Cooking For Engineers is a funny blog. Check it out!

Definition von Mobbing nach Esser und Wolmerath

Mobbing ist ein Geschehensprozess in der Arbeitswelt, in dem desktruktive Handlungen unterschiedlichster Art wiederholt und über einen längeren Zeitraum gegen Einzelne vorgenommen werden, welche von dem Betroffenen als eine Beinträchtigung und Verletzung ihrer Person empfunden werden und dessen ungebremster Verlauf für die Betroffenen grundsätzlich dazu führt, dass ihre psychische Befindlichkeit und Gesundheit zunehmend beeinträchtigt werden, ihre Isolation und Ausgrenzung am Arbeitsplatz zunhemen, dagegen die Chancen auf eine zufriedenstellende Lösung schwinden und der regelmäßig im Verlust ihres bisherigen beruflichen Wirkbereichs endet.

Auswahl an Mobbinghandlungen

Hier ein paar Zitate aus einem Buch zum Thema Mobbing von Holger Wyrwa:

Anordnung von überfordernden Tätigkeiten

Zuweisung von objektive zu viel Arbeit

Entscheidungen oder Kompetenzen werden permanent angezweifelt.

Ständige Entmutigung

Absichtlich schlechte berufliche Beurteilung; Behauptung von Schlechtleistungen

Generalisierung von Fehlern, pauschale Kritik (z.B.: "Sie machen alles falsch!")

Aufbauschen einzelner Vorfälle oder Fehler ("Maus zum Elefanten machen")

Unterdrückung von Meinungsäußerungen des Betroffenen (z.B. "Mund verbieten")

Lächerlich machen (z.B. verbal, mit Mimik, mit Gestik, durch Karikatur)

Dauerkontrolle, übertriebene Kontrolle

Berufliche Entmündigung

Einschüchtern, Bedrohen, Nötigen (z.B. drohen mit dem Arbeitsplatzverlust, körperliche Gewaltandrohung)

Zuweisung schlechter Urlaubstermine

Herbeiführen von gesundheitlichen Beeinträchtigungen (z.B. Zugluft, Kälte, Hitze, Lautstärke, Stinkbomben)

Verharmlosen, Lächerlichmachen von Beschwerden

Wednesday, September 08, 2004

iTunes für Windows

Habe mir gerade die neuste iTunes für Windows Version geholt. Ich wurde mit den Worten begrüßt:

Vielen Dank, dass Sie die iTunes Software laden. Beim nächsten Mal erhalten Sie die neuesten Aktualisierungen automatisch über die Systemeinstellung "Software-Aktualisierung". Weitere Infos zur Verwendung der Funktion "Software-Aktualisierung".


Tuesday, September 07, 2004

Metro-Busse vom HVV?

Nicht mit der Metro AG!

Kommt bald das Ende aller Metropolen?
Internet-Unrecht goes Real Life: Konzern will ein Wort komplett verbieten lassen


Saturday, September 04, 2004

Mitarbeiter motivieren für DUMMIES

Ich war heute in einer Buchhandlung und habe in der "Beruf/Job/Karriere" Ecke gestöbert und fand das Ergebnis erschreckend. U. a. habe ich ein wenig in dem Buch Mitarbeiter motivieren für DUMMIES geblättert. Egal welche Seite ich aufschlug: Das was man NICHT tun sollte, wird bei uns in der Firma getan.

Ich habe dann die "Mobbing" Bücher durchstöbert, und auch hier bin ich fündig geworden. So Manches aus diesen Büchern kann man auch bei uns in der Firma finden.

Ich habe mir dann ein Buch zum Thema Mobbing und Buch zum Thema Initiativ-Bewerbungen gekauft. Ich weiß nicht ob die Probleme in der Firma Zielgerichtet herbeigeführt werden, um Leute rauszueckeln oder einfach nur aus der Unfähigkeit zur Mitarbeiterführung herrühren. Ich weiß nur das mich die derzeitige Situation Krank macht. Morgens empfinde ich den Gedanken in die Arbeit zu gehen als unerträglich und fast schmerzhaft. Ich empfinde jede Stunde die ich in der Firma verbringe als vergeudete Zeit. Ich zähle die Stunden bis Feierabend. Einen Tag daheim mit Kopfschmerzen zu verbringen empfinde ich als befreiende Wohltat für mich. So kann es einfach nicht weitergehen.

Während ich vor ein paar Tagen fest entschlossen war, Ende September zu kündigen, habe ich nach einem Gespräch mit einem Kollegen und der Lektüre eines Buches ein differenziertes Bild. Ich werde mir einen neuen Arbeitgeber suchen aber bis dahin werde ich mich gegen die Zustände in der Firma wehren. Der Gedanke nicht mehr wehrlos den Bedingungen in der Firma ausgesetzt zu sein, erhellt bereits meine Stimmung. Letztendlich steht mein Entschluss die Firma zu verlassen fest, und ich kann frei sein von dem Gedanken, meinen Arbeitsplatz zu verlieren. Falls man mir kündigen sollte, kann ich es gelassener nehmen, denn ich wollte sowieso gehen. Um mit Red Zack zu sprechen "So what?". Und aus Bremen stammt bekanntlich die Weisheit, das man etwas besseres als den Tod überall finden kann.

Friday, September 03, 2004

Build Tools for .NET

I just found a promising build tool for .NET:
It's open source and supposed to be good.

Obviously, MS had to copy it and created MSBuild. Apparently this fully integrated in .NET 2005 IDE.

Some blogs at MS cover MSBuild:

MS Buildprocess and Bugtracking blog

I found a blog from a guy at MS, in which he talks about build processes, bugtracking and so on.


Interesting to see how MS handles this.

Sidenote: Nice to see how open MS can be :-)

Signal Processing on GPUs - Sony funding Nuclear Weapon Design?

The Stanford University Graphics Lab has a program called BrookGPU, which offers a high-level and C-like programing language called Brook. This may be interesting for anybody wanting to do signal processing on GPUs (Graphic Processors).

Now the other thing is, that the site names as sponsors IBM, SONY, ATI, NVIDIA, DARPA, and DOE and that the related Merrimac - Stanford Streaming Supercomputer Project has the intention to build a even faster (and cheaper) supercomputer.

Now do I hear anybody hear say "Atombomb design"? And yes a document states that "verifying nuclear weapons, performing signal intelligence" and "the design of nuclear devices" can be done better on such a machine.

Cubase SX 3 announced

From Harmony Central:


Cubase SX3 also sees another first: implementation of the first level of Studio Connections announced this year at Frankfurt Musikmesse. Representing the first fruits of the development alliance between Steinberg and music instruments and audio hardware manufacturer Yamaha, Studio Connections technology has been incorporated into the SX 3 release, with total system Recall functionality. SX3 integrates Yamaha's Studio Manager 2 software which serves as a link between the sequencer and hardware editing components. Each editor component can be opened like a Plug-in from within Cubase SX3. Entire studio setups are saved and recalled with the project. Supported hardware currently includes Yamaha's DM2000, 01x and 02r96 mixers, as well as the Motif ES synthesizer and SPX2000 signal processor.

  • Audio Warp: Realtime Time Stretching and Pitch Shifting offer extensive new audio editing and processing capabilities, including ACID File support: loops automatically adopt a project's tempo; audio files can follow tempo changes in realtime.

  • External FX Plugins allow for direct integration of external hardware effects processors into the VST audio mixer. Use your favorite outboard gear just like plugins -- including automatic delay compensation
  • Extended Freeze function for virtual instruments and audio tracks with added flexibility and improved performance. Freeze virtual instruments with or without insert effects. Then automatically unload the instrument to free up RAM. Freeze audio tracks with insert effects to free up even more CPU performance.

  • A Dummy Plugin automatically replaces missing plugins when a project is transferred to a different system. This project can be saved and sent back -- the original plugins will automatically open up again.


Von Terrornest zur sichersten Grossstadt Europas?


"Go fuck yourself"

Dreamworks trys to sue ThePirateBay.org, "the worlds largest BirTorrent tracker".

Here is their response:

As you may or may not be aware, Sweden is not a state in the United States of America. Sweden is a country in northern Europe. Unless you figured it out by now, US law does not apply here. For your information, no Swedish law is being violated.

Please be assured that any further contact with us, regardless of medium, will result in
a) a suit being filed for harassment
b) a formal complaint lodged with the bar of your legal counsel, for sending frivolous legal threats.

It is the opinion of us and our lawyers that you are fucking morons, and that you should please go sodomize yourself with retractable batons.

Please also note that your e-mail and letter will be published in full on http://www.thepiratebay.org.

Go fuck yourself.

Polite as usual,


Wednesday, September 01, 2004

Can't reach google...

I must die...
The end is near...

Idiots work everywhere

Yes, its true, even at such companies as Friendster ("social network"), you can get fired by people who don't understand chickenshit about anything.