* Posts by Peter Geoghegan

5 posts • joined 7 May 2009

Nokia N900 Linux smartphone

Peter Geoghegan

The browser uses technology based on Firefox and it's a good one

I thought that the browser was based on Konqueror's/Chrome's/Safari's webkit layout engine, not Mozilla's Gecko layout engine.

Is this an error?

0
0

Nokia carves out Qt future

Peter Geoghegan

@ Anonymous Coward - Qt needs a lot of work?

Qt is the best documented application framework I've ever encountered - their documentation is exceptionally good. qmake is the easiest to use build system/makemake I have ever encountered, with the possible exception of cmake. Your remark that "it can't clean itself reliably" is bizarre - on Linux, a simple "make clean" does it for me, or if I'm using visual studio integration on Windows, clean all from the build menu. Have you ever tried using autotools, or autohell as it's known colloquially? That's a dog's breakfast. The only configuration parameters that are generally needed by qmake are what parts of Qt you want to link to (Just the core, DB module, XML module etc), and what additional non Qt libraries you want to link to, and if you want a debug or release build. It's difficult to imagine how it could be more simple, particularly if you use the Qt creator IDE - all of these details are usually specified in a single .pro file, which creator will maintain for you if you let it. Incidentally, Qt creator is the best IDE currently available for Linux - it is superior to both KDevelop and Anjuta, even for non-Qt, non-qmake projects.

How can the embedded version be even worse, given that it's *identical* for most practical purposes? There are a few tiny differences that most Qt embedded developers aren't even aware of, because they don't have to be. The build system is identical. You can easily build a Qt desktop application for Qt embedded - that's a major selling point of Qt.

You say "It's a typical pile of sucky OSS cobbled together into an even bigger mess than any one OSS component". This is nonsense. Qt was maintained for years as a single, coherent project by Trolltech, a private company. They were quite conservative in accepting new code (see reg article "Nokia's Qt cuts paperwork for open sourcers"), and didn't grant any third party access to their revision control system. It isn't cobbled together by any reasonable standard.

How you could express an opinion that is so patently inconsistent with the facts is beyond me. I think that the fact that you chose to post as an anonymous coward, and I posted my rebuttal using my real name is telling.

0
0
Peter Geoghegan

@ Andus McCoatover - EEE tactics?

I think it's ironic that you're comparing Nokia to Microsoft, or suggesting that they're adopting the EEE doctrine, given that Qt is a cross platform framework that compiles natively on Windows, Mac, Linux with X11, Symbian, Windows CE and embedded Linux, available under the liberal weak copyleft LGPL, using the native look and feel of each platform. Also, recall that Nokia's new N900 smart phone is totally open - there was a video on youtube of someone with a root shell on an N900.

Frankly, Symbian developers should be delighted with this development, because Qt is brilliant. Nokia are doing the right thing here.

0
0

An unthinking programmer's guide to the new C++

Peter Geoghegan

@Martin Usher - gross inaccuracies

"C++ started out life as an honest pre-processor for everyone's favorite systems programming language (which had accidentally slipped into role of applications language after PCs became common)."

Stroustrup's original compiler that partially implemented the language (as it existed then), cfront, created at Bell labs in 1983 was implemented as a preprocessor, back when C++ was known as "C with classes" and was considered highly academic. So what? The stated goal of Stroustrup from the beginning was that C++ was "designed to provide Simula’s facilities for program organization together with C’s efficiency and flexibility for systems programming." The suggestion that C++ "accidentally slipped into role of applications language after PCs became common" is preposterous - it became dominant because it popularised generic and object orientated programming for systems and application programming, and there wasn't anything better at the time. For many domains, there continues to be nothing better.

"I, too, try to push people at Python or other modern scripting languages for user programs."

I too code in Python, and think it's great. I think that it often makes sense to use RAD tools or scripting languages, especially given that they can be extended with C++ where necessary through the use of boost.python. Bram Cohen's original BitTorrent client was written (and refined) in Python, but the BitTorrent inc (formerly uTorrent) client is written in C++. Why? Because if it was written in Python, or even Java, it would be at a commercially disadvantage to other, faster clients that are written in C++, and users must have a python interpreter on their computer or a JVM. Sure, that performance difference is a feature that must be evaluated on its own merits just like every other feature, but it often still matters, as in this case. People talk about garbage collection

You are treating C++ as an extension to C, which betrays an ignorance on your part. If you really want to annoy a C++ person, use the term "C/C++". As I've already said in a previous post, C++ is much safer than C. It's quite possible to know C++ and not know C, because C forces the user to use dynamically allocated arrays, return codes, macros, extensive casting, weaker typing (when you use malloc in C++, it returns a void pointer. When you use new is C++, it returns a pointer of the requested type. If you use malloc in C++, you must explicitly cast the void pointer to the desired type), and does not provide safe abstractions like the standard containers, or allow you to create your own safe abstractions through idioms like RAII and language features like templates.

C++ haters often imagine that C++ code has mallocs haphazardly placed everywhere as with C, coupled with high level abstractions, which actually would be dangerous. C++ programmers know to use abstractions like the standard containers, and RAII to avoid "sullying their hands" (as I believe Scott Meyers put it) with explicit memory management wherever possible. This makes memory leaks extremely rare in practice, and makes the supposed panacea of garbage collection look unattractive.

1
0
Peter Geoghegan
Thumb Down

Questioning the motives of C++ haters

Concepts, or concept checking, explicate the implicit interface of templates. They are a way of ameliorating the problem of templates producing terrible error messages when used incorrectly. Prominent C++ pundit Scott Meyers, well known in the C++ community as the author of the "Effective C++" series, has questioned the necessity of concept checking in the new standard.

The whole point of supporting initialiser lists (the { } syntax) is to allow classes, particularly containers such as std::vector to be initalised like arrays. i.e.:

std::vector<int> container = { 5, 6, 7, 8};

This previously wasn't possible.

References aren't pointless. They are safer than pointers, in that they cannot be null, must be initialised, and their value cannot be changed once initialised - They become an "alternative name" for the value, as oppose to some distinct construct that points to the value. This facilitates operator overloading, and simplifies code. If it wasn't for references, you'd have to de-reference the pointer returned by the operator:

my_class a, b;

...

my_class c = *(a + b); // returns a pointer that is de-referenced - defeats the purpose of operator overloading

As against:

my_class c = a + b; // exploits user's intuition of what + ought to mean

C++ certainly has more than its fair share of warts, but can we please see an article written by someone that understands the rationale behind the introduction of C++0x's new features?

I have plenty of criticism I could make of C++ in general, and C++0x in particular, but I feel most of C++'s defects can be attributed to historical reasons, or the fact that major sub parts don't gel together flawlessly. It seems to me that often the shrillness of the criticism you hear of it posted anonymously on the internet is in direct inverse proportion to the poster's actual knowledge of the subject - typically, they make sweeping remarks like "C++ is shit", or "C++ is to C as lung cancer is to lung", whatever that means. Why is it shit? If it is shit, how do you account for the fact that many major projects have successfully been completed in C++, among them GoogleFS, Photoshop, Firefox and openoffice.org - are the organisations that created those project just stupid? What would you write, say, photoshop in if you were starting from scratch? I suspect that these people's needs ( I suspect that they're web application developers and Java/C# developers that produce middle of the road business apps) are not best addressed by C++ in any case, but perhaps if they tried a modern C++ framework like Qt or WxWidgets they'd find that many of the oft-repeated put-downs are overstated, outdated, or just false (example: C++ is the only language that combines higher level abstractions with manual memory management, which is bad. Ever hear of RAII, or for that matter Ada?). Some of these same criticisms can be made of C (most prominently, things about the inherent dangers of native code), but people don't criticise C because Unix is C and Unix is cool and I'm a hacker. The difference with C++ is that you don't have to use C's low level constructs like char pointers for strings, or printf statements - there's always a much better, safer alternative.

A common, and valid, criticism of C++ is that it poorly encapsulates compilation units, necessitating recompiling client code when a class's definition is changed. That's the price you pay for the speed of having true local variables on the stack - the size of the class must be known in advance of compilation. The greater point illustrated by this example is that, essentially, C++ addresses the needs of a large (though largely reticent) group of people with a particular set of requirements that want the particular set of trade-offs that are least bad to them. Could there be, in principle, a language that better addresses *their* needs or preferences? Definitely. Is there one? For most of them, no. The number of people using C++ is not currently in decline (it was a few years ago), it just isn't growing as fast as the user base of other languages (source: Bjarne Stroustrup's website).

2
0

Forums