In comp.os.linux.advocacy, The Ghost In The Machine
on Wed, 22 Nov 2000 23:03:51 GMT
>In comp.os.linux.advocacy, Pete Goodwin
>on Tue, 21 Nov 2000 21:25:36 +0000
>>Now, how do you do "hello world" in WIN32, or X, or KDE2?
>The X "hello world" takes about 50 lines or so.
Update: I've just looked at a rather simple implementation (my own)
of "hello world" using raw X windows (no widgets). It takes 80
lines, or 1,540 characters -- and that's without comments.
It draws two windows (one inside the other) with the text more
or less in the center of the secondwindow, and does almost
everything properly. At least, I think it does... :-)
Quote:>The Win32 "hello world" takes even more.
136 lines for the .cpp file, 7 lines for an include file,
and 80 lines for the .rc file, for a grand total of 223 lines.
Note that the .h and the .rc file are auto-generated by
Borland. And this isn't even quite the correct solution,
as it simply draws an 'X', instead of printing "hello world"
(although a one-line substitution would take care of that, I think).
10 of those lines are comments; 17 of these lines are dedicated
to class registration (which must be done prior to opening
a window, if it's not one of the "standard" window types, I guess).
It also doesn't open a second window within the first.
(I don't remember if Windows can support that or not; X can
implement an arbitrary tree of windows.)
Note that there's more up-to-date technology available, as
well; I don't know if VC++ would use so many lines, for example.
(Of course, it might cheat and use additional DLL calls, too. :-) )
Another update: the GTK tutorial has a "hello, world"-type program
that has 98 lines, but has a lot of comments explaining things
and some extra glop regarding delete events and button pressings
(the "hello world" is in fact a pressable button).
up 74 days, 2:49, running Linux.