Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

OT: Why is C so popular?

0 views
Skip to first unread message

Alex Malinovich

unread,
Aug 27, 2003, 2:20:08 AM8/27/03
to
The recent COBOL discussion has gotten me to thinking. Some languages
seem to be very popular in some situations. C is easily the dominant
language for most things Linux. So therein lies the question. Why,
exactly, is C so popular? Especially in comparison to C++. I can't think
of a single reason to use C instead of C++ for most of the coding that I
would do. I generally only write user applications. I don't get anywhere
near the kernel which is where I'd imagine most of the reason for using
C comes in. Yet I see people writing 'modern' GUI applications and using
C when I would think C++ would be a much better choice. Is there
something that I'm missing? Something that C actually does better than
C++ in regards to higher-level functions?

(Note that I tend to gravitate towards higher level languages by nature.
I use Perl religiously, and I love Java. If not for some of the speed
limitations and, more importantly, the fact that it's non-free, I would
say that Java is the perfect language. Hmm... is that gasoline I smell?
:)

--
Alex Malinovich
Support Free Software, delete your Windows partition TODAY!
Encrypted mail preferred. You can get my public key from any of the
pgp.net keyservers. Key ID: A6D24837

signature.asc

Steve Lamb

unread,
Aug 27, 2003, 2:20:09 AM8/27/03
to
On Wed, 27 Aug 2003 01:11:08 -0500
Alex Malinovich <demo...@the-love-shack.net> wrote:
> (Note that I tend to gravitate towards higher level languages by nature.
> I use Perl religiously, and I love Java. If not for some of the speed
> limitations and, more importantly, the fact that it's non-free, I would
> say that Java is the perfect language. Hmm... is that gasoline I smell?
> :)

<match>
Fool, everyone knows Python is the one true language.
</match>

--
Steve C. Lamb | I'm your priest, I'm your shrink, I'm your
PGP Key: 8B6E99C5 | main connection to the switchboard of souls.
-------------------------------+---------------------------------------------

Loren M Lang

unread,
Aug 27, 2003, 3:00:24 AM8/27/03
to
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, 27 Aug 2003, Alex Malinovich wrote:

> The recent COBOL discussion has gotten me to thinking. Some languages
> seem to be very popular in some situations. C is easily the dominant
> language for most things Linux. So therein lies the question. Why,
> exactly, is C so popular? Especially in comparison to C++. I can't think
> of a single reason to use C instead of C++ for most of the coding that I
> would do. I generally only write user applications. I don't get anywhere
> near the kernel which is where I'd imagine most of the reason for using
> C comes in. Yet I see people writing 'modern' GUI applications and using
> C when I would think C++ would be a much better choice. Is there
> something that I'm missing? Something that C actually does better than
> C++ in regards to higher-level functions?

I can think of a few reasons myself:
1) Compatibility
2) Speed
3) Portability

1) Libraries are a good thing to be written in C unless they are
specifically releated to a programming language that is not C like the
standard C++ libraries. It is very easy to write a wrapper for a library
written in C for use in other languages like Perl, Python, C++, Java,
Ruby. But much harder to write a wrapper for a C++ library to use in
other languages like C, etc. The Arts client libraries are a good example
of that situation. The libraries are written in C++ with a special
library that acts as a C wrapper. The problem is the wrapper library is
severly limited compared to the C++ libraries, my guess is the programmers
got a little lazy when it came time to write the wrapper and it has caused
me some trouble trying to use the libraries.

Also, any C library can be used in C++ without a wrapper, but a wrapper is
required for the other direction.

And have you ever tried to open a C++ library using dlopen()? It requires
at least one C function to start with since all the C++ functions names
are mangles. It's doable, but a little bit of a pain.

Lastly, C has more libraries for a user programs then any other language
except C++ of course.

2) C is just faster than C++ and much faster then almost any other choice
as far as code speed. Even when I'm writing in C++ I will use fopen() and
fprint() for file I/O then the C++ equilelants because they are noticably
faster. C++ with never make it into the kernel for this reason along with
others.

3) C is more portable then C++. I can take almost any C code and use it
with almost any C or C++ compiler or even other variations like Objective
C or Dynamic C with very few problems. Most exceptions are maybe use of
newer features of C like ## or enum or directives like #pragma. In some
enviorments C is the only way to go, other languages like Cobol, C++, or
Perl are just too high level. Once case is the TI-89, it's to limited to
run C++ effectively. I've never seen anyone even attempt to write a C++
compiler for it. Other embedded systems like Microchip's PIC
microcontrollers are just barely leaving asm for C now, it will be a while
before they will support C++. Rabbit Semiconductor sells a Z80 based
microchips and they created a language called Dynamic C which is basicly C
with special support for state machines. It won't do C++ either.

If people don't learn C before C++, it A) a little harder to learn
properly, and B) it's harder for them to learn other languages later like
C, Objective C, and Dynamic C with are all C dirivatives.


I think this is at least a little sample of why C is better sometimes than
C++.

>
> (Note that I tend to gravitate towards higher level languages by nature.
> I use Perl religiously, and I love Java. If not for some of the speed
> limitations and, more importantly, the fact that it's non-free, I would
> say that Java is the perfect language. Hmm... is that gasoline I smell?
> :)
>
>

- --
I sense much NT in you.
NT leads to Bluescreen.
Bluescreen leads to downtime.
Downtime leads to suffering.
NT is the path to the darkside.
Powerful Unix is.

Public Key: ftp://ftp.tallye.com/pub/lorenl_pubkey.asc
Fingerprint: B3B9 D669 69C9 09EC 1BCD 835A FAF3 7A46 E4A3 280C

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE/TFXH+vN6RuSjKAwRAqtwAJ9BgmxVuO7UZvwdMofzsYTq4guIkACcD9jI
c+DW3CWqzTO24OjznYWYeyM=
=2ghl
-----END PGP SIGNATURE-----


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org

Ron Johnson

unread,
Aug 27, 2003, 4:30:23 AM8/27/03
to
On Wed, 2003-08-27 at 01:16, Steve Lamb wrote:
> On Wed, 27 Aug 2003 01:11:08 -0500
> Alex Malinovich <demo...@the-love-shack.net> wrote:
> > (Note that I tend to gravitate towards higher level languages by nature.
> > I use Perl religiously, and I love Java. If not for some of the speed
> > limitations and, more importantly, the fact that it's non-free, I would
> > say that Java is the perfect language. Hmm... is that gasoline I smell?
> > :)
>
> <match>
> Fool, everyone knows Python is the one true language.
> </match>

And it runs on OpenVMS, which is The One True OS!!

--
-----------------------------------------------------------------
Ron Johnson, Jr. ron.l....@cox.net
Jefferson, LA USA

"Millions of Chinese speak Chinese, and it's not hereditary..."
Dr. Dean Edell

Ron Johnson

unread,
Aug 27, 2003, 5:00:10 AM8/27/03
to
On Wed, 2003-08-27 at 01:54, Loren M Lang wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Wed, 27 Aug 2003, Alex Malinovich wrote:
>
> > The recent COBOL discussion has gotten me to thinking. Some languages
> > seem to be very popular in some situations. C is easily the dominant
> > language for most things Linux. So therein lies the question. Why,
> > exactly, is C so popular? Especially in comparison to C++. I can't think
> > of a single reason to use C instead of C++ for most of the coding that I
> > would do. I generally only write user applications. I don't get anywhere
> > near the kernel which is where I'd imagine most of the reason for using
> > C comes in. Yet I see people writing 'modern' GUI applications and using
> > C when I would think C++ would be a much better choice. Is there
> > something that I'm missing? Something that C actually does better than
> > C++ in regards to higher-level functions?
>
> I can think of a few reasons myself:
> 1) Compatibility
> 2) Speed
> 3) Portability

It's only compatible and portable on similar platforms. Any C
code that chock full of Linux system calls won't portable to any
other platform unless a (gasp) compatibility layer is written 1st.
Same thing happens with glibc. There are functions in it which
are non-portable to Solaris, AIX & HP-UX, not to mention non-Unix
OSs.

Bottom line: I can write user-level C code that is *highly* de-
pendant on a given OS and libc implementation.

COBOL and FORTRAN are probably the 2 most portable languages, since
they are so highly specified, and there are always compiler options
to flag implementation extensions.

Python is *very* portable, but even it has platform-specific
functions. It's relatively easy, though, to compensate with run-
time conditional execution.

Given that the app programmer is adequately skilled and uses the
proper algorithms, speed is dependent upon the compiler writer's
skill, nothing more.

--
-----------------------------------------------------------------
Ron Johnson, Jr. ron.l....@cox.net
Jefferson, LA USA

The difference between Rock&Roll and Country Music?
Old Rockers still on tour are pathetic, but old Country singers
are still great.

Ron Johnson

unread,
Aug 27, 2003, 5:10:10 AM8/27/03
to
On Wed, 2003-08-27 at 01:11, Alex Malinovich wrote:
> The recent COBOL discussion has gotten me to thinking. Some languages
> seem to be very popular in some situations. C is easily the dominant
> language for most things Linux. So therein lies the question. Why,
> exactly, is C so popular? Especially in comparison to C++. I can't think
> of a single reason to use C instead of C++ for most of the coding that I
> would do. I generally only write user applications. I don't get anywhere
> near the kernel which is where I'd imagine most of the reason for using
> C comes in. Yet I see people writing 'modern' GUI applications and using
> C when I would think C++ would be a much better choice. Is there
> something that I'm missing? Something that C actually does better than
> C++ in regards to higher-level functions?
>
> (Note that I tend to gravitate towards higher level languages by nature.
> I use Perl religiously, and I love Java. If not for some of the speed
> limitations and, more importantly, the fact that it's non-free, I would
> say that Java is the perfect language. Hmm... is that gasoline I smell?

- Habit
- Tradition
- Availability

1 - If most people know C, then most apps will be written in C,
out of sheer momentum.

2 - C is The Language Of Unix, Unix is Great, We Use Unix, there-
fore We Write In C. (The fact that for a long time, cc came as
part of Unix played a part in this. Why spend Big Bucks for a
Fortran or COBOL compiler, when C is "free as in beer"?) This
attitude is diminishing, now that so many other free languages are
available for *ix.

3 - "I learned C in college, and C lets me write in 1 long line
that which takes 3 easy-to-read lines in Fortran. Thus, C is great,
and all other languages suck!". Fortunately, this attitude is also
diminishing. Unfortunately, nowadays "s/C /Perl /".

--
-----------------------------------------------------------------
Ron Johnson, Jr. ron.l....@cox.net
Jefferson, LA USA

"Experience should teach us to be most on our guard to protect
liberty when the Government's purposes are beneficent. Men born
to freedom are naturally alert to repel invasion of their
liberty by evil-minded rulers. The greatest dangers to liberty
lurk in insidious encroachment by men of zeal, well-meaning, but
without understanding."
Justice Louis Brandeis, dissenting, Olmstead v US (1928)

Frank Gevaerts

unread,
Aug 27, 2003, 7:20:16 AM8/27/03
to
On Wed, Aug 27, 2003 at 01:11:08AM -0500, Alex Malinovich wrote:
> The recent COBOL discussion has gotten me to thinking. Some languages
> seem to be very popular in some situations. C is easily the dominant
> language for most things Linux. So therein lies the question. Why,
> exactly, is C so popular? Especially in comparison to C++. I can't think
> of a single reason to use C instead of C++ for most of the coding that I
> would do. I generally only write user applications. I don't get anywhere
> near the kernel which is where I'd imagine most of the reason for using
> C comes in. Yet I see people writing 'modern' GUI applications and using
> C when I would think C++ would be a much better choice. Is there
> something that I'm missing? Something that C actually does better than
> C++ in regards to higher-level functions?

First convince me that object oriented programming results in
maintainable and debuggable code, then convince me that C++ is a good
implementation of OO, and then I might consider C++ instead of C. (I
know not all the features of C++ are related to OO, but OO seems to be
the main selling point of C++ vs C)

> (Note that I tend to gravitate towards higher level languages by nature.
> I use Perl religiously, and I love Java. If not for some of the speed
> limitations and, more importantly, the fact that it's non-free, I would
> say that Java is the perfect language. Hmm... is that gasoline I smell?
> :)

Have you ever looked at an operator precedence table for Java ? One line
says : "+, -, +" (the last + is for string concatenation). Add to this
the principle of strong typing and giving compilation erros whenever you
omit an explicit cast, except of course if the first variable might be a
string and strings are so cool so we convert everything else to a
string... Whoever thought that was a good idea should be shot.
Java makes strings expensive and easy to use at the same time, and that
is not a good idea. And it is OO ;-)

Frank

>
> --
> Alex Malinovich
> Support Free Software, delete your Windows partition TODAY!
> Encrypted mail preferred. You can get my public key from any of the
> pgp.net keyservers. Key ID: A6D24837

--

Colin Watson

unread,
Aug 27, 2003, 7:30:25 AM8/27/03
to
On Wed, Aug 27, 2003 at 03:46:00AM -0500, Ron Johnson wrote:
> It's only compatible and portable on similar platforms. Any C
> code that chock full of Linux system calls won't portable to any
> other platform unless a (gasp) compatibility layer is written 1st.

That's why you don't do that, and write to the C standard and POSIX
instead. Once in a while you need a very small compatibility layer, but
this is more rare in well-written programs than you seem to think.

Cheers,

--
Colin Watson [cjwa...@flatline.org.uk]

Paul Johnson

unread,
Aug 27, 2003, 7:40:12 AM8/27/03
to
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, Aug 27, 2003 at 01:11:08AM -0500, Alex Malinovich wrote:
> The recent COBOL discussion has gotten me to thinking. Some languages
> seem to be very popular in some situations. C is easily the dominant
> language for most things Linux. So therein lies the question. Why,
> exactly, is C so popular?

It's relatively easy to learn, plus everybody else in the unix world
uses C. It's portable. It helps to know your history: C was created
to write unix to begin with.

- --
.''`. Paul Johnson <ba...@ursine.ca>
: :' :
`. `'` proud Debian admin and user
`- Debian - when you have better things to do than fix a system
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/TJQhUzgNqloQMwcRAiQaAJ4+mZPffMTDcfyu9esw9PXhIjRSeACggh88
F5CVDr2suZmdIXECUmWwMX4=
=XOXV
-----END PGP SIGNATURE-----

Paul Johnson

unread,
Aug 27, 2003, 7:50:11 AM8/27/03
to
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, Aug 26, 2003 at 11:54:58PM -0700, Loren M Lang wrote:
> If people don't learn C before C++, it A) a little harder to learn
> properly, and B) it's harder for them to learn other languages later like
> C, Objective C, and Dynamic C with are all C dirivatives.

While I haven't learned much C yet (I can read it better than I write
it), I do have to ask this one: It's possible to write
non-braindamaged code in C++ without learning C first?

- --
.''`. Paul Johnson <ba...@ursine.ca>
: :' :
`. `'` proud Debian admin and user
`- Debian - when you have better things to do than fix a system

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/TJWTUzgNqloQMwcRAr5BAKDFognTUuFIc5+A6O55bQr7RbCg4wCfUdtC
I816axC1q1DhUOvQnDPrDEo=
=xkd9

Elie De Brauwer

unread,
Aug 27, 2003, 8:00:09 AM8/27/03
to
On Wednesday 27 August 2003 12:43, Frank Gevaerts wrote:
> On Wed, Aug 27, 2003 at 01:11:08AM -0500, Alex Malinovich wrote:
> > The recent COBOL discussion has gotten me to thinking. Some languages
> > seem to be very popular in some situations. C is easily the dominant
> > language for most things Linux. So therein lies the question. Why,
> > exactly, is C so popular? Especially in comparison to C++. I can't think
> > of a single reason to use C instead of C++ for most of the coding that I
> > would do. I generally only write user applications. I don't get anywhere
> > near the kernel which is where I'd imagine most of the reason for using
> > C comes in. Yet I see people writing 'modern' GUI applications and using
> > C when I would think C++ would be a much better choice. Is there
> > something that I'm missing? Something that C actually does better than
> > C++ in regards to higher-level functions?
>
> First convince me that object oriented programming results in
> maintainable and debuggable code, then convince me that C++ is a good
> implementation of OO, and then I might consider C++ instead of C. (I
> know not all the features of C++ are related to OO, but OO seems to be
> the main selling point of C++ vs C)

I agree, but when it comes to documentation c is the absolute top.
man strchr, man strlen, man strcmp, man sin, man cos it's all in the manuals
but try do get a description from some of the functions from the C++ STL out
of the manpage. It is hardly possible to code C++ and use the features
(vector, list, queue and more of those prety things) without buying some dead
trees.
C is perfectly commented in the manpages, php has php.net, java has the api
documentation, perl has perldoc and c++ has /dev/null (i know the first
remark is that all c functions that are commented are part of of c++ and you
have a piece).

--
http://www.de-brauwer.be

Paul Johnson

unread,
Aug 27, 2003, 8:00:21 AM8/27/03
to
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, Aug 27, 2003 at 03:59:27AM -0500, Ron Johnson wrote:
> 2 - C is The Language Of Unix, Unix is Great, We Use Unix, there-
> fore We Write In C. (The fact that for a long time, cc came as
> part of Unix played a part in this. Why spend Big Bucks for a
> Fortran or COBOL compiler, when C is "free as in beer"?)

Wouldn't it make more sense and sound cooler to say "free as in C" then?

> 3 - "I learned C in college, and C lets me write in 1 long line
> that which takes 3 easy-to-read lines in Fortran. Thus, C is great,
> and all other languages suck!". Fortunately, this attitude is also
> diminishing. Unfortunately, nowadays "s/C /Perl /".

Wouldn't it be easier to read if you wrote it s/C/Perl/ ?

- --
.''`. Paul Johnson <ba...@ursine.ca>
: :' :
`. `'` proud Debian admin and user
`- Debian - when you have better things to do than fix a system
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/TJc2UzgNqloQMwcRAmCgAJ9cIEfLTRElatrFqLo4t6mhyQLb6ACeLOgr
teuqq8XTDXkWQxs6HQStb4s=
=Wx9T
-----END PGP SIGNATURE-----

Paul Johnson

unread,
Aug 27, 2003, 8:00:22 AM8/27/03
to
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, Aug 27, 2003 at 12:43:55PM +0200, Frank Gevaerts wrote:
> First convince me that object oriented programming results in
> maintainable and debuggable code, then convince me that C++ is a good
> implementation of OO, and then I might consider C++ instead of C. (I
> know not all the features of C++ are related to OO, but OO seems to be
> the main selling point of C++ vs C)

I thought C was pretty object-oriented, unless I'm totally confused on
the concept. (If not, what does .o stand for if not Object?)

- --
.''`. Paul Johnson <ba...@ursine.ca>
: :' :
`. `'` proud Debian admin and user
`- Debian - when you have better things to do than fix a system
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/TJd7UzgNqloQMwcRAp3nAKDDUxUx9CJaHV641c/wiP9CqVBQuQCglZua
VYTvA9ZL7BU/DOJsY1TreQ0=
=FeY7
-----END PGP SIGNATURE-----

Magnus Therning

unread,
Aug 27, 2003, 8:40:09 AM8/27/03
to
On Wed, Aug 27, 2003 at 04:35:23AM -0700, Paul Johnson wrote:
>On Wed, Aug 27, 2003 at 12:43:55PM +0200, Frank Gevaerts wrote:
>> First convince me that object oriented programming results in
>> maintainable and debuggable code, then convince me that C++ is a good
>> implementation of OO, and then I might consider C++ instead of C. (I
>> know not all the features of C++ are related to OO, but OO seems to be
>> the main selling point of C++ vs C)
>
>I thought C was pretty object-oriented, unless I'm totally confused on
>the concept. (If not, what does .o stand for if not Object?)

Different kind of object! '.o' is the suffix to denote object code, cf.
'.so' is shared object (also called DLL, or DLO).

Any language can be used to program object oriented (to various
degrees). Some languages have constructs and features to support that
style of programming, hence people call them object oriented languages.
C is not considered to be an object oriented language.

/M

--
Magnus Therning mailto:ther...@sourceforge.natlab.research.philips.com
PGP:0xD3BC7468 +31-40-2745179 http://pww.innersource.philips.com/magnus/

One, demonstrations always crash. And two, the probability of them crashing
goes up exponentially with the number of people watching.
-- Steve Jobs

Peter Hugosson-Miller

unread,
Aug 27, 2003, 8:50:08 AM8/27/03
to
Frank Gevaerts wrote:

> On Wed, Aug 27, 2003 at 01:11:08AM -0500, Alex Malinovich wrote:
>
>> The recent COBOL discussion has gotten me to thinking. Some languages
>> seem to be very popular in some situations. C is easily the dominant
>> language for most things Linux. So therein lies the question. Why,
>> exactly, is C so popular? Especially in comparison to C++. I can't think
>> of a single reason to use C instead of C++ for most of the coding that I
>> would do. I generally only write user applications. I don't get anywhere
>> near the kernel which is where I'd imagine most of the reason for using
>> C comes in. Yet I see people writing 'modern' GUI applications and using
>> C when I would think C++ would be a much better choice. Is there
>> something that I'm missing? Something that C actually does better than
>> C++ in regards to higher-level functions?
>
>
> First convince me that object oriented programming results in
> maintainable and debuggable code,

Object oriented analysis and design produces nothing more than an Object
model of the problem space. A good Object model will allow you to find
the Classes you will need to create, and the use-cases these Classes
should provide. The use-cases will in turn allow you to identify your
test-cases. None of this has anything to do with any programming language.

Whether or not the resulting code is maintainable and debuggable depends
not only on a good Object model but on how well the chosen programming
language allows you to implement the model, and the skill of the
programmer. If your model is good, and the language allows you enough
flexibility, then the resulting code should be merely a
compiler-friendly version of the Object model, and just as maintainable.

> then convince me that C++ is a good implementation of OO, and then I
> might consider C++ instead of C. (I know not all the features of C++
> are related to OO, but OO seems to be the main selling point of C++ vs C)

C++ is C with some OO-like features added to it. It is not a pure OO
language, but a hybrid, and there is nothing in the language that forces
you to use Classes and Objects. It does allow you to do a fair bit of OO
implementation, but you will still have to switch between Objects and
primitive types from time to time, do the odd type cast, and take care
of all the memory management and garbage collection by yourself. Then
there is the dreaded pointer arithmetic, which has absolutely nothing to
do with OO, but is pure C.

I think that the popularity of C has more to do with "what's out there",
when newcomers want to teach themselves programming. There's so much to
look at, both good and bad, and it's easy to find examples that you can
try out and modify. Hands up, how many people have written new C code by
using old C code as a template?

Sure, there are performance reasons for choosing C, but they only really
come in to play in those few applications that have real-time
constraints. I would say it's better to learn good OO analysis and
design, choose your favourite language for normal use, then make
exceptions from this language if and when you need the extra performance.

>> (Note that I tend to gravitate towards higher level languages by nature.
>> I use Perl religiously, and I love Java. If not for some of the speed
>> limitations and, more importantly, the fact that it's non-free, I would
>> say that Java is the perfect language. Hmm... is that gasoline I smell?
>> :)
>
>
> Have you ever looked at an operator precedence table for Java ? One line
> says : "+, -, +" (the last + is for string concatenation). Add to this
> the principle of strong typing and giving compilation erros whenever you
> omit an explicit cast, except of course if the first variable might be a
> string and strings are so cool so we convert everything else to a
> string... Whoever thought that was a good idea should be shot.
> Java makes strings expensive and easy to use at the same time, and that
> is not a good idea. And it is OO ;-)

LOL :-) Java isn't pure OO either - there are plenty of things in Java
that aren't Objects. Sure it's much better at doing OO than either C or
C++, but you still have to make compromises. Also, it's non-free, as
Alex pointed out (not that this affects the suitability of Java per se),
which means that it will probably not spread so fast in the Linux world.
I think we're stuck with C and C++, so why not try to use them as well
as possible, and choose the one you really need depending on what you
want to do...

--
Cheers,

.~.
/V\
// \\
/( )\
^`~彭
< hugge >

"I'll give up Smalltalk when they pry the browser from my cold, dead
fingers!"

Ron Johnson

unread,
Aug 27, 2003, 9:00:13 AM8/27/03
to
On Wed, 2003-08-27 at 05:52, Colin Watson wrote:
> On Wed, Aug 27, 2003 at 03:46:00AM -0500, Ron Johnson wrote:
> > It's only compatible and portable on similar platforms. Any C
> > code that chock full of Linux system calls won't portable to any
> > other platform unless a (gasp) compatibility layer is written 1st.
>
> That's why you don't do that, and write to the C standard and POSIX
> instead. Once in a while you need a very small compatibility layer, but
> this is more rare in well-written programs than you seem to think.

But the point is that it can easily be done, and often is, to get
that extra feature, or reduce the SLOC by a dozen or so, or to speed
it up a little bit.

Another thing that kills portability is the need to call functions
that only have a library on a specific platform.

--
-----------------------------------------------------------------
Ron Johnson, Jr. ron.l....@cox.net
Jefferson, LA USA

Some former UNSCOM officials are alarmed, however. Terry Taylor,
a British senior UNSCOM inspector from 1993 to 1997, says the
figure of 95 percent disarmament is "complete nonsense because
inspectors never learned what 100 percent was. UNSCOM found a
great deal and destroyed a great deal, but we knew [Iraq's] work
was continuing while we were there, and I'm sure it continues,"
says Mr. Taylor, now head of the Washington
http://www.csmonitor.com/2002/0829/p01s03-wosc.html

Ron Johnson

unread,
Aug 27, 2003, 10:10:12 AM8/27/03
to
On Wed, 2003-08-27 at 06:34, Paul Johnson wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Wed, Aug 27, 2003 at 03:59:27AM -0500, Ron Johnson wrote:
> > 2 - C is The Language Of Unix, Unix is Great, We Use Unix, there-
> > fore We Write In C. (The fact that for a long time, cc came as
> > part of Unix played a part in this. Why spend Big Bucks for a
> > Fortran or COBOL compiler, when C is "free as in beer"?)
>
> Wouldn't it make more sense and sound cooler to say "free as in C" then?

Ummm, but "free as in beer" is the traditional, and understood,
way of saying "zero direct money spent".

> > 3 - "I learned C in college, and C lets me write in 1 long line
> > that which takes 3 easy-to-read lines in Fortran. Thus, C is great,
> > and all other languages suck!". Fortunately, this attitude is also
> > diminishing. Unfortunately, nowadays "s/C /Perl /".
>
> Wouldn't it be easier to read if you wrote it s/C/Perl/ ?

So that it wouldn't change Choo-choo to Perlhoo-choo. I wasn't
just thinking of that one paragraph...

--
-----------------------------------------------------------------
Ron Johnson, Jr. ron.l....@cox.net
Jefferson, LA USA

"Basically, I got on the plane with a bomb. Basically, I tried
to ignite it. Basically, yeah, I intended to damage the plane."
RICHARD REID, tried to blow up American Airlines Flight 63

Ron Johnson

unread,
Aug 27, 2003, 10:10:14 AM8/27/03
to
On Wed, 2003-08-27 at 06:35, Paul Johnson wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Wed, Aug 27, 2003 at 12:43:55PM +0200, Frank Gevaerts wrote:
> > First convince me that object oriented programming results in
> > maintainable and debuggable code, then convince me that C++ is a good
> > implementation of OO, and then I might consider C++ instead of C. (I
> > know not all the features of C++ are related to OO, but OO seems to be
> > the main selling point of C++ vs C)
>
> I thought C was pretty object-oriented, unless I'm totally confused on
> the concept. (If not, what does .o stand for if not Object?)

That's a joke, right?

--
-----------------------------------------------------------------
Ron Johnson, Jr. ron.l....@cox.net
Jefferson, LA USA

"Perl is worse than Python because people wanted it worse."
Larry Wall, 10/14/1998

Ron Johnson

unread,
Aug 27, 2003, 10:20:12 AM8/27/03
to
On Wed, 2003-08-27 at 06:21, Paul Johnson wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Wed, Aug 27, 2003 at 01:11:08AM -0500, Alex Malinovich wrote:
> > The recent COBOL discussion has gotten me to thinking. Some languages
> > seem to be very popular in some situations. C is easily the dominant
> > language for most things Linux. So therein lies the question. Why,
> > exactly, is C so popular?
>
> It's relatively easy to learn, plus everybody else in the unix world
> uses C. It's portable. It helps to know your history: C was created
> to write unix to begin with.

To sound like your mother: because everybody else in the world jumps
off a cliff, does that mean you should? Of course not...

In other words, programmers who use C primarily because "everybody
else in the unix world uses C" and "C was created to write unix to
begin with" are sheep.

Give me a better reason, like "I need to touch the hardware", or
"the scripting language I use only allows binary extensions to be
written in C".

--
-----------------------------------------------------------------
Ron Johnson, Jr. ron.l....@cox.net
Jefferson, LA USA

"Fear the Penguin!!"

Ron Johnson

unread,
Aug 27, 2003, 10:50:27 AM8/27/03
to
On Wed, 2003-08-27 at 07:15, Peter Hugosson-Miller wrote:
> Frank Gevaerts wrote:
>
> > On Wed, Aug 27, 2003 at 01:11:08AM -0500, Alex Malinovich wrote:
[snip]

> I think we're stuck with C and C++, so why not try to use them as well
> as possible, and choose the one you really need depending on what you
> want to do...

Python!!!!!!!!!! Object oriented, and methods that need speed are
wrapped around C.

--
-----------------------------------------------------------------
Ron Johnson, Jr. ron.l....@cox.net
Jefferson, LA USA

"All machines, no matter how complex, are considered to be based
on 6 simple elements: the lever, the pulley, the wheel and axle,
the screw, the wedge and the inclined plane."
Marilyn Vos Savant

Francois Bottin

unread,
Aug 27, 2003, 11:10:14 AM8/27/03
to
Quoting Ron Johnson <ron.l....@cox.net>:
> On Wed, 2003-08-27 at 06:34, Paul Johnson wrote:
> > On Wed, Aug 27, 2003 at 03:59:27AM -0500, Ron Johnson wrote:
> > > 3 - "I learned C in college, and C lets me write in 1 long line
> > > that which takes 3 easy-to-read lines in Fortran. Thus, C is great,
> > > and all other languages suck!". Fortunately, this attitude is also
> > > diminishing. Unfortunately, nowadays "s/C /Perl /".
> >
> > Wouldn't it be easier to read if you wrote it s/C/Perl/ ?
>
> So that it wouldn't change Choo-choo to Perlhoo-choo. I wasn't
> just thinking of that one paragraph...
>
Then: s/\bC\b/Perl/g ;-)
(Yes, I also added a g at the end to not only substitute the 1st occurence)

Francois.

--
Francois BOTTIN
--
"How kind," the PFY sighs. "But where will I go?"
"Somewhere where they know nothing about computing...
where they wouldn't know a RAM chip from a potato chip!"
"But I don't want to visit Microsoft!" he whines.
The BOFH 1998 - Simon Travaglia (bofh.ntk.net)

Dave Howorth

unread,
Aug 27, 2003, 11:10:16 AM8/27/03
to
>>> Unfortunately, nowadays "s/C /Perl /".
>>Wouldn't it be easier to read if you wrote it s/C/Perl/ ?
> So that it wouldn't change Choo-choo to Perlhoo-choo.

When I saw the question, I thought the obvious counter-example was so
that it doesn't change C# to Perl# :)

Now that's a frightening thought. Just what would Perl# be like?

Cheers, Dave

PS I'm a Luddite that refuses to learn C++. Backward compatibility with
C was the single biggest mistake Stroustrup made.

Tom Badran

unread,
Aug 27, 2003, 11:20:09 AM8/27/03
to
On Wednesday 27 Aug 2003 14:32, Ron Johnson wrote:
> Give me a better reason, like "I need to touch the hardware", or
> "the scripting language I use only allows binary extensions to be
> written in C".

Very true, i use C for embedded work because i need direct control over the
hardware, and being able to see the exact asm code generated and tweak when
necessary is a huge bonus in this situation. However, if I'm writing
something that isn't either performance critical or very low level platform
specific code, i would always use either Java or Python (others will have
their preferences here - i hear great things about ruby for instance), Ive
even been known to prototype certain code in Haskell when that language seems
appropriate.

Tom

--
^__^ Tom Badran
(oo)\______ Imperial College
(__)\ )\/\
||----w |
|| || Using Debian SID

John Hasler

unread,
Aug 27, 2003, 12:00:09 PM8/27/03
to
Ron Johnson writes:
> But the point is that it can easily be done, and often is, to get that
> extra feature, or reduce the SLOC by a dozen or so, or to speed it up a
> little bit.

The only one of my packages that makes any system calls is chrony (it mucks
about with the clock) and it has a compatibility layer.

> Another thing that kills portability is the need to call functions that
> only have a library on a specific platform.

Most well-written libraries are themselves portable.
--
John Hasler
jo...@dhh.gt.org
Dancing Horse Hill
Elmwood, Wisconsin

Alfredo Valles

unread,
Aug 27, 2003, 12:30:18 PM8/27/03
to
On Wednesday 27 August 2003 3:59 pm, Ron Johnson wrote:
> On Wed, 2003-08-27 at 07:15, Peter Hugosson-Miller wrote:
> > Frank Gevaerts wrote:
> > > On Wed, Aug 27, 2003 at 01:11:08AM -0500, Alex Malinovich wrote:
>
> [snip]
>
> > I think we're stuck with C and C++, so why not try to use them as well
> > as possible, and choose the one you really need depending on what you
> > want to do...
>
> Python!!!!!!!!!! Object oriented, and methods that need speed are
> wrapped around C.


And very very slow too, like any other script language.


I like python, there are several techniques to accelerate python (like weave
and psyco) but for a good speed C is the best.

Mike Mueller

unread,
Aug 27, 2003, 12:30:24 PM8/27/03
to
On Wednesday 27 August 2003 07:27, Paul Johnson wrote:
> I do have to ask this one:  It's possible to write
> non-braindamaged code in C++ without learning C first?

Yes. But I think it's more fun to learn OO using Python than it is using C++.

And now to over-analyse the term "brain-damaged".

Mixing C style (e.g., functions and data structures) and techniques (e.g.,
CPU and memory awareness) in C++ code (with its abstractions using
hierarchical objects and templates) is "brain-damaged" to some critics.

But even if you use C++ correctly, your object space may be conceived in a
way that is different from how you critic perceives the object space. In
this case your code will be "brain-damaged"

Solution? Learn C because it's the lingua franca and it works well. The OO
learning curve with Python is manageable, so learn Python to build OO
solutions. Java is probably a great OO choice too - I haven't cracked that
nut yet. The Sun control of Java seems a little...closed...to me.

C++ works perfectly for me precisely because it is a mixes C and C++ so
easily. I work on a bit-oriented protocol (C part) that I manage with some
OO techniques (C++ part). I think my code will earn a place of honor in the
"brain-damaged" C++ hall of fame.

Recently SCO showed some "offending" code and the chuck was determined to be
a memory allocator written by some UNIX and C progenitors. Linus said it was
removed from 2.6 by someone because it was judged to be "ugly". Ugly.
Brain-damaged. Crappy. Nasty. What's the difference? Code that is deemed
beautiful or clever is often either incomprehensible or obvious.

Code that works is a gift.

--
Mike Mueller
324881 (08/20/2003)
Make clockwise circles on the floor with your right foot; now, without
looking at your foot, use the index finger on your right hand to draw the
number "6" in the air

Sebastian Kapfer

unread,
Aug 27, 2003, 1:00:14 PM8/27/03
to
On Wed, 27 Aug 2003 09:00:24 +0200, Loren M Lang wrote:

> 2) C is just faster than C++

This is simply not true. If you know what you're doing, you can write
efficient C++ which is just as fast as C. C++ was designed in a way that
doesn't make you pay for features you don't use.

> Even when I'm writing in C++ I will use fopen() and fprint() for file
> I/O then the C++ equilelants because they are noticably faster.

iostreams don't have to be slower by design; unfortunately they often are
implemented on top of the C library, which forces them to be slower.
(Somehow I find C streams more convenient than C++ streams, but that's a
matter of personal preference.)

> If people don't learn C before C++, it A) a little harder to learn
> properly

This is common prejudice. However, "idiomatic" C++ is vastly different
from C. If your only goal is grasping C++, then learning C is a waste of
time.

--
Best Regards, | Hi! I'm a .signature virus. Copy me into
Sebastian | your ~/.signature to help me spread!

Sebastian Kapfer

unread,
Aug 27, 2003, 1:00:15 PM8/27/03
to
On Wed, 27 Aug 2003 13:50:11 +0200, Paul Johnson wrote:

> While I haven't learned much C yet (I can read it better than I write
> it), I do have to ask this one: It's possible to write non-braindamaged
> code in C++ without learning C first?

Of course it is -- it's just more difficult :-)

--
Best Regards, | Hi! I'm a .signature virus. Copy me into
Sebastian | your ~/.signature to help me spread!

Sebastian Kapfer

unread,
Aug 27, 2003, 1:10:08 PM8/27/03
to
On Wed, 27 Aug 2003 13:20:16 +0200, Frank Gevaerts wrote:

> First convince me that object oriented programming results in maintainable
> and debuggable code, then convince me that C++ is a good implementation of
> OO, and then I might consider C++ instead of C. (I know not all the
> features of C++ are related to OO, but OO seems to be the main selling
> point of C++ vs C)

Who ever said that C++ was about OO? C++ is a quite usable OO language,
but it can also be used as a "better C", ignoring the non-imperative
parts. C++ doesn't force any academically interesting design decisions on
you. Stroustrup once called C++ a multiparadigm language, and that's what
it is. Strong imperative and OO facilities, but there are a few other
influences too (like generic aka templates).

--
Best Regards, | Hi! I'm a .signature virus. Copy me into
Sebastian | your ~/.signature to help me spread!

Ron Johnson

unread,
Aug 27, 2003, 1:10:09 PM8/27/03
to
On Wed, 2003-08-27 at 09:17, Dave Howorth wrote:
> >>> Unfortunately, nowadays "s/C /Perl /".
> >>Wouldn't it be easier to read if you wrote it s/C/Perl/ ?
> > So that it wouldn't change Choo-choo to Perlhoo-choo.
>
> When I saw the question, I thought the obvious counter-example was so
> that it doesn't change C# to Perl# :)
>
> Now that's a frightening thought. Just what would Perl# be like?
>
> Cheers, Dave
>
> PS I'm a Luddite that refuses to learn C++. Backward compatibility with
> C was the single biggest mistake Stroustrup made.

Gee, I thought I was a Luddite for not wanting my kids to start
playing computer games when they turned 3.

--
-----------------------------------------------------------------
Ron Johnson, Jr. ron.l....@cox.net
Jefferson, LA USA

Great Inventors of our time:
Al Gore -> Internet
Sun Microsystems -> Clusters

Gregory Seidman

unread,
Aug 27, 2003, 1:10:12 PM8/27/03
to
On Wed, Aug 27, 2003 at 12:43:55PM +0200, Frank Gevaerts wrote:
} On Wed, Aug 27, 2003 at 01:11:08AM -0500, Alex Malinovich wrote:
[...]

} First convince me that object oriented programming results in
} maintainable and debuggable code, then convince me that C++ is a good
} implementation of OO, and then I might consider C++ instead of C. (I
} know not all the features of C++ are related to OO, but OO seems to be
} the main selling point of C++ vs C)

OO was, at one time, the primary purpose of C++ extending C. It no longer
is. C++ is a tolerable, if annoying, OO language but it is hardly an
exemplary one. It does, however, have templating and the standard library
(formerly the Standard Template Library, a.k.a. STL). This allows some very
powerful and elegant code, and provides an astoundingly flexible library of
common data structures and algorithms. The Boost project is working on
creating an even more comprehensive library (for possible inclusion into
the next C++ standard). It is generic programming, enabled by C++ templates
and OO, that give C++ it's value.

As an example of how C tries and fails to do the same sort of thing,
consider the standard C qsort() function. The qsort() function is generic,
but lacks any sort of type safety. The C++ templated sort function provides
the same generic sort function, but with type safety.

[...]
} Frank
--Greg

Ron Johnson

unread,
Aug 27, 2003, 1:40:13 PM8/27/03
to
On Wed, 2003-08-27 at 04:06, Alfredo Valles wrote:
> On Wednesday 27 August 2003 3:59 pm, Ron Johnson wrote:
> > On Wed, 2003-08-27 at 07:15, Peter Hugosson-Miller wrote:
> > > Frank Gevaerts wrote:
> > > > On Wed, Aug 27, 2003 at 01:11:08AM -0500, Alex Malinovich wrote:
> >
> > [snip]
> >
> > > I think we're stuck with C and C++, so why not try to use them as well
> > > as possible, and choose the one you really need depending on what you
> > > want to do...
> >
> > Python!!!!!!!!!! Object oriented, and methods that need speed are
> > wrapped around C.
>
>
> And very very slow too, like any other script language.

One thing I learned a *long* time ago is that even an 80286 is faster
than people typing, reading the screen, moving the mouse, getting a
cup of coffee, etc.

> I like python, there are several techniques to accelerate python (like weave
> and psyco) but for a good speed C is the best.

Don't forget NumPy.


--
-----------------------------------------------------------------
Ron Johnson, Jr. ron.l....@cox.net
Jefferson, LA USA

"Vanity, my favorite sin."
Larry/John/Satan, "The Devil's Advocate"

Gregory Seidman

unread,
Aug 27, 2003, 1:50:10 PM8/27/03
to
On Wed, Aug 27, 2003 at 02:27:50PM +0200, Elie De Brauwer wrote:
[...]

} I agree, but when it comes to documentation c is the absolute top. man
} strchr, man strlen, man strcmp, man sin, man cos it's all in the manuals
} but try do get a description from some of the functions from the C++ STL
} out of the manpage. It is hardly possible to code C++ and use the
} features (vector, list, queue and more of those prety things) without
} buying some dead trees.
}
} C is perfectly commented in the manpages, php has php.net, java has the
} api documentation, perl has perldoc and c++ has /dev/null (i know the
} first remark is that all c functions that are commented are part of of
} c++ and you have a piece).

The only reason you can't find documentation for C++ libraries is because
you haven't looked. Stop spreading misinformation and STFW. Explore the
URLs below.

http://www.sgi.com/tech/stl/
http://www.dinkumware.com/refxcpp.html

While I did voluntarily purchase one dead tree book on C++ (I have others,
but they were either free or required for a class, and I haven't found any
of them useful), I also voluntarily purchased one dead tree book on C (and
have others that were free and minimally useful). I have found both books
useful through the years, but rarely refer to either now that I have gained
sufficient expertise with the languages, not to mention the convenience of
the aforementioned websites.

--Greg

Ron Johnson

unread,
Aug 27, 2003, 2:00:17 PM8/27/03
to
On Wed, 2003-08-27 at 09:42, John Hasler wrote:
> Ron Johnson writes:
> > But the point is that it can easily be done, and often is, to get that
> > extra feature, or reduce the SLOC by a dozen or so, or to speed it up a
> > little bit.
>
> The only one of my packages that makes any system calls is chrony (it mucks
> about with the clock) and it has a compatibility layer.
>
> > Another thing that kills portability is the need to call functions that
> > only have a library on a specific platform.
>
> Most well-written libraries are themselves portable.

(Warning: reference to non-FLOSS software.) But you can't always
know if the the library is portable.

--
-----------------------------------------------------------------
Ron Johnson, Jr. ron.l....@cox.net
Jefferson, LA USA

"Fear the Penguin!!"

Alan Shutko

unread,
Aug 27, 2003, 2:20:07 PM8/27/03
to
Alex Malinovich <demo...@the-love-shack.net> writes:

> C is easily the dominant language for most things Linux. So therein

> lies the question. Why, exactly, is C so popular? Especially in
> comparison to C++.

The free software culture started much before Linux. Much free
software was written to run on many different Unix systems.
Historically, a C compiler was available on all of them. Even after
vendors started dropping C compilers, they often included an old
K&R-style C compiler which was enough to bootstrap GCC. The C ABI was
very stable, and you didn't need to recompile everything all the time.
It wasn't too bad getting shared libraries to work on most platforms.

In contrast, C++ was not available on most Unices with the base
system. When it was purchased as an upgrade, it turned out that
different vendors C++ compilers were often buggy and incompatible in
many ways. Sure, you could require that everyone install GCC, but
that was plagued with its own set of problems. In the end, you were
stuck using a much decreased subset of C++ for very little benefit.

Then C++ was plagued with a very long standardization process where
the language changed greatly and compiler vendors had to play catchup.
It's only just getting to the point where compilers fairly faithfully
implement the language, and are reasonably compatible, nine years
after I first saw C++. And on linux, you still have binary
compatibility issues (look at how you have to use a different JVM
under Mozilla depending on what compiler it was compiled with).

As a consequence of this, very little free software was written with
C++. It just wasn't worth the minimal gains you might get for the
headaches it caused. Groff was the only app I can think of that
historically used C++, and ISTR it had problems along the line.

This is slowly changing, as we have Mozilla, OpenOffice.org, and KDE,
but you asked for the history....

--
Alan Shutko <a...@acm.org> - I am the rocks.

Michael Heironimus

unread,
Aug 27, 2003, 3:10:10 PM8/27/03
to
On Wed, Aug 27, 2003 at 08:32:31AM -0500, Ron Johnson wrote:
> On Wed, 2003-08-27 at 06:21, Paul Johnson wrote:
> > It's relatively easy to learn, plus everybody else in the unix world
> > uses C. It's portable. It helps to know your history: C was created
> > to write unix to begin with.
>
> To sound like your mother: because everybody else in the world jumps
> off a cliff, does that mean you should? Of course not...
>
> In other words, programmers who use C primarily because "everybody
> else in the unix world uses C" and "C was created to write unix to
> begin with" are sheep.

Uh, that's what people do. The world is full of sheeple who just move
from one cliff to the next, and we all have to deal with the results.
Sometimes it's a cliff and you KNOW it's a cliff, but you don't really
have a choice.

The world jumped off the UNIX/C cliff, so we'll never get that last E
added to the creat() call.

The world jumped off the mainframe/COBOL cliff, so now some companies
are having to decide if it's more painful to try to keep upgrading and
enhancing existing systems or to throw away millions of dollars and
buy/build something to do what they need now instead of what they needed
30 years ago.

The world jumped off the IBM PC cliff, so we're still dealing with some
of the design mistakes IBM made the first time around.

Right now the world is in the process of jumping off the Java/J2EE/web
app cliff. I have a feeling that the Java apps written a few years from
now will be very, very different from what people are writing now.
Products like WebSphere, Tomcat, JBoss, etc. aren't big because they use
Java, Java is big because there are high-quality products that use it
and big companies with big marketing teams backing it.

It doesn't matter how good or bad Java, C, or any other language might
be. What counts is who's backing it, what you can do with it, and how
fast you can do it (how good the development tools are, how much of of
that code you already have, etc.). How important each of those is
depends on where you are and who you're talking to. A lot of times the
decision isn't even based on sound technical advice, just on company
politics, product marketing, and short-term cost.

--
Michael Heironimus

Ron Johnson

unread,
Aug 27, 2003, 3:10:12 PM8/27/03
to
On Wed, 2003-08-27 at 10:06, Mike Mueller wrote:
> On Wednesday 27 August 2003 07:27, Paul Johnson wrote:
> > I do have to ask this one: It's possible to write
> > non-braindamaged code in C++ without learning C first?
>
> Yes. But I think it's more fun to learn OO using Python than it is using C++.
[snip]

> Solution? Learn C because it's the lingua franca and it works well. The OO
> learning curve with Python is manageable, so learn Python to build OO
> solutions. Java is probably a great OO choice too - I haven't cracked that
> nut yet. The Sun control of Java seems a little...closed...to me.
>
> C++ works perfectly for me precisely because it is a mixes C and C++ so
> easily. I work on a bit-oriented protocol (C part) that I manage with some
> OO techniques (C++ part). I think my code will earn a place of honor in the
> "brain-damaged" C++ hall of fame.

How about Python with C modules for the stuff that C does better/
faster than Python?

--
-----------------------------------------------------------------
Ron Johnson, Jr. ron.l....@cox.net
Jefferson, LA USA

"For me and windows it became a matter of easy to start with,
and becoming increasingly difficult to be productive as time
went on, and if something went wrong very difficult to fix,
compared to linux's large over head setting up and learning the
system with ease of use and the increase in productivity
becoming larger the longer I use the system."
Rohan Nicholls , The Netherlands

Ron Johnson

unread,
Aug 27, 2003, 3:20:16 PM8/27/03
to
On Wed, 2003-08-27 at 09:53, Gregory Seidman wrote:
> On Wed, Aug 27, 2003 at 12:43:55PM +0200, Frank Gevaerts wrote:
> } On Wed, Aug 27, 2003 at 01:11:08AM -0500, Alex Malinovich wrote:
> [...]
> } First convince me that object oriented programming results in
> } maintainable and debuggable code, then convince me that C++ is a good
> } implementation of OO, and then I might consider C++ instead of C. (I
> } know not all the features of C++ are related to OO, but OO seems to be
> } the main selling point of C++ vs C)
>
> OO was, at one time, the primary purpose of C++ extending C. It no longer
> is. C++ is a tolerable, if annoying, OO language but it is hardly an
> exemplary one. It does, however, have templating and the standard library
> (formerly the Standard Template Library, a.k.a. STL). This allows some very
> powerful and elegant code, and provides an astoundingly flexible library of
> common data structures and algorithms. The Boost project is working on
> creating an even more comprehensive library (for possible inclusion into
> the next C++ standard). It is generic programming, enabled by C++ templates
> and OO, that give C++ it's value.
>
> As an example of how C tries and fails to do the same sort of thing,
> consider the standard C qsort() function. The qsort() function is generic,
> but lacks any sort of type safety. The C++ templated sort function provides
> the same generic sort function, but with type safety.

If you want a C-like OO language with type safety, why not use Java?

--
-----------------------------------------------------------------
Ron Johnson, Jr. ron.l....@cox.net
Jefferson, LA USA

"Why should we not accept all in favor of woman suffrage to our
platform and association even though they be rabid pro-slavery
Democrats."
Susan B. Anthony, _History_of_Woman_Suffrage_
http://www.ifeminists.com/introduction/essays/introduction.html

Deryk Barker

unread,
Aug 27, 2003, 4:00:18 PM8/27/03
to
Thus spake Ron Johnson (ron.l....@cox.net):

> On Wed, 2003-08-27 at 04:06, Alfredo Valles wrote:

....


> > > Python!!!!!!!!!! Object oriented, and methods that need speed are
> > > wrapped around C.
> >
> >
> > And very very slow too, like any other script language.
>
> One thing I learned a *long* time ago is that even an 80286 is faster
> than people typing, reading the screen, moving the mouse, getting a
> cup of coffee, etc.

Yes, I'd be interested in knowing why python should be considered
"very very slow". I've been using it extensively for several years and
have had no performance issues.

>
> > I like python, there are several techniques to accelerate python (like weave
> > and psyco) but for a good speed C is the best.
>
> Don't forget NumPy.

Or SWIG. C may be best for "good speed" wrt execution, but in terms of
development time.....
--
|Deryk Barker, Computer Science Dept. | Music does not have to be understood|
|Camosun College, Victoria, BC, Canada| It has to be listened to. |
|email: dba...@camosun.bc.ca | |
|phone: +1 250 370 4452 | Hermann Scherchen. |

David Z Maze

unread,
Aug 27, 2003, 4:00:22 PM8/27/03
to
Alfredo Valles <alf...@bioinfo.cu> writes:

> On Wednesday 27 August 2003 3:59 pm, Ron Johnson wrote:
>>
>> Python!!!!!!!!!! Object oriented, and methods that need speed are
>> wrapped around C.
>
>
> And very very slow too, like any other script language.

What do you really need the speed for? If you're going to write
computationally intensive code, then yeah, you probably want C or
FORTRAN, since a lot of work has gone into the compilers for those
languages and the language is closer to what the hardware
understands. But otherwise, programmer cycles can count for a lot,
too.

Python actually in my mind has quite a few things going for it. It's
one of the only mainstream languages to have a lambda construct (lisp
isn't that mainstream, perl has sub refs but it's kind of gross). The
syntax is fairly familiar if you've ever used another language, and
doesn't have too much punctuation (lisp has parens, perl has the $@%*
variable modifiers). It also has a fairly nice standard library, and
good documentation readily available. If you're into OOP, Python
classes are fairly straightforward (though method dispatching is
always by-name, so concepts like Java interfaces are very informal in
Python). It's garbage collected, which IMHO is really important for a
language/runtime.

Downsides? It's not blazingly fast, though I haven't found it
painfully slow either. (It feels faster to me than Java, but part of
this is almost certainly the expensive startup cost of a standard
JVM.) If you're into correctness checking, it's harder to determine
the type of an object at compile time than in other languages;
pychecker is a program that will try to give warnings if a program
isn't "correct" according to standard OO methodology.

--
David Maze dm...@debian.org http://people.debian.org/~dmaze/
"Theoretical politics is interesting. Politicking should be illegal."
-- Abra Mitchell

Elie De Brauwer

unread,
Aug 27, 2003, 4:10:13 PM8/27/03
to
> } C is perfectly commented in the manpages, php has php.net, java has the
> } api documentation, perl has perldoc and c++ has /dev/null (i know the
> } first remark is that all c functions that are commented are part of of
> } c++ and you have a piece).
>
> The only reason you can't find documentation for C++ libraries is because
> you haven't looked. Stop spreading misinformation and STFW. Explore the
> URLs below.
>
> http://www.sgi.com/tech/stl/
> http://www.dinkumware.com/refxcpp.html

Ok, let me rephrase my comments, c++ hasn't got documentation in an obvious
place, but thanks for the links anyhow :D

greetings

--
http://www.de-brauwer.be

Steve Lamb

unread,
Aug 27, 2003, 4:20:13 PM8/27/03
to
On Wed, 27 Aug 2003 04:21:05 -0700
Paul Johnson <ba...@ursine.ca> wrote:
> It's relatively easy to learn, plus everybody else in the unix world
> uses C. It's portable. It helps to know your history: C was created
> to write unix to begin with.

*cough, spit* I was able to grasp Turbo Pascal far before C. I had no
problems with Perl. Hell, I learned Python in a week. C.. C I still poke at
with a 2' stick in the eye and hope it goes away and I've taken several
classes in C and have tried to work with it several times over the years.

--
Steve C. Lamb | I'm your priest, I'm your shrink, I'm your
PGP Key: 8B6E99C5 | main connection to the switchboard of souls.
-------------------------------+---------------------------------------------

Steve Lamb

unread,
Aug 27, 2003, 4:30:08 PM8/27/03
to
On Wed, 27 Aug 2003 04:35:23 -0700
Paul Johnson <ba...@ursine.ca> wrote:
> I thought C was pretty object-oriented, unless I'm totally confused on
> the concept. (If not, what does .o stand for if not Object?)

Yeah, I'll play into your ploy. Now take just that o, change one function
in it and make it another o.

Steve Lamb

unread,
Aug 27, 2003, 4:30:18 PM8/27/03
to
On Wed, 27 Aug 2003 16:17:30 +0200
Francois Bottin <fbo...@free.fr> wrote:
> Quoting Ron Johnson <ron.l....@cox.net>:
> > On Wed, 2003-08-27 at 06:34, Paul Johnson wrote:
> > > Wouldn't it be easier to read if you wrote it s/C/Perl/ ?

> > So that it wouldn't change Choo-choo to Perlhoo-choo. I wasn't
> > just thinking of that one paragraph...

> Then: s/\bC\b/Perl/g ;-)
> (Yes, I also added a g at the end to not only substitute the 1st occurence)

Still doesn't work when sentences end in C.

Steve Lamb

unread,
Aug 27, 2003, 4:50:09 PM8/27/03
to
On Wed, 27 Aug 2003 10:55:41 -0500
Ron Johnson <ron.l....@cox.net> wrote:
> On Wed, 2003-08-27 at 04:06, Alfredo Valles wrote:
> > And very very slow too, like any other script language.

> One thing I learned a *long* time ago is that even an 80286 is faster
> than people typing, reading the screen, moving the mouse, getting a
> cup of coffee, etc.

I've got to agree there. I recall doing word processing on my Tandy
1000HX and wonder why the hell Word needs 40Mb just to start up.

As for Python being "very, very slow" compared to C I'd like to know who
Alfredo can define something as "very, very slow" compared to something else
when in most cases the difference would be measured in ms. Lemme give a
simple example.

I recently installed sa-exim. As a result I've got this large corpus of
unlearned spam sitting in several directories. I want to sort through it and
send it to ham or spam of sa-learn. After trying to do it with the CLI I gave
up and decided to write a Python app to do it. Enter Saeman (bad, I know).

Saeman is written in Python using wxPython as the base and constructed
with Boa-Constructor. wxPython is mainly a Python wrapper around the
wxWindows libs (or so I have been told) which, in turn, uses GTK 1.x. I'm
running it on a PIII-450 sitting in the closet using TightVNC to export the
display to a old IBM Thinkpad that has a PII-200 in it.

So let me be clear on this. I am using a "very, very slow" scripting
language on a "very, very slow" (by today's standards) machine exporting it
across a "very, very slow" link that is VNC to display it on a "very, very....
very... uh... very slow" laptop. Even with all that inefficiency built into
how I get the work done the application, simplistic as it is, is just as fast,
to me, as any C application running over the same link (like Sylpheed-Claws
here) or indeed any locally run application on the Win2k box VNC is running
on. If that's "very, very slow" I'm perfectly content with that.

Mike Mueller

unread,
Aug 27, 2003, 5:20:10 PM8/27/03
to
On Wednesday 27 August 2003 11:05, Gregory Seidman wrote:
> The only reason you can't find documentation for C++ libraries is because
> you haven't looked. Stop spreading misinformation and STFW. Explore the
> URLs below.
>
> http://www.sgi.com/tech/stl/

That link is not that helpful in learning STL. Neither is the deadtree STL
Tutorial and Ref. by Musser et al.

This book is good:
http://www.josuttis.com/libbook/


--
Mike Mueller
324881 (08/20/2003)
Make clockwise circles on the floor with your right foot; now, without
looking at your foot, use the index finger on your right hand to draw the
number "6" in the air

Diego Calleja García

unread,
Aug 27, 2003, 6:00:24 PM8/27/03
to
El Wed, 27 Aug 2003 01:11:08 -0500 Alex Malinovich <demo...@the-love-shack.net> escribió:


> C comes in. Yet I see people writing 'modern' GUI applications and using
> C when I would think C++ would be a much better choice. Is there
> something that I'm missing? Something that C actually does better than
> C++ in regards to higher-level functions?

Performance (aka "bloatage") (just run openoffice, kde...)

(Yeah, some people can get good performance because they're good c++ coders.
Probably it's not even a 1% of all c++ coders though)

Another reason: great C compilers. (yeah, c++ is getting better...)

Thomas Krennwallner

unread,
Aug 27, 2003, 6:10:13 PM8/27/03
to
Hi!

On Wed Aug 27, 2003 at 12:02:23PM -0500, Michael Heironimus wrote:
> It doesn't matter how good or bad Java, C, or any other language might
> be. What counts is who's backing it, what you can do with it, and how
> fast you can do it (how good the development tools are, how much of of
> that code you already have, etc.). How important each of those is
> depends on where you are and who you're talking to. A lot of times the
> decision isn't even based on sound technical advice, just on company
> politics, product marketing, and short-term cost.

And that all doesn't matter if you're a free software developer...
You use the tools YOU like, the language YOU think is the right one for
your project and don't have to give a damn about other opinions why this
or that language has to be better than the other.

There is no such language which performs in all situations well. C is
fast, but you have to code really careful and double-check your source.
Erlang was designed for telephony tasks (message passing, ...). Prolog
is superior in expert systems. Perl is real good for quick string hacks.
Python scales better than Perl for larger projects and is good for rapid
prototyping. C++ scales well in large-scale software designs which needs
to be fast...

But that all doesn't matter. Every language has its pros and cons and
trying to find THE language will end in esotheric discussions.

For me its clear: use the language you think is good for completing a
given task. I know you cannot always make this decision but if you have
the chance, choose carefully ;-)

So long
Thomas

--
.''`. Obviously we do not want to leave zombies around. - W. R. Stevens
: :' : Thomas Krennwallner <djmaecki at ull dot at>
`. `'` 1024D/67A1DA7B 9484 D99D 2E1E 4E02 5446 DAD9 FF58 4E59 67A1 DA7B
`- http://bigfish.ull.at/~djmaecki/

Gregory Seidman

unread,
Aug 27, 2003, 6:20:18 PM8/27/03
to
On Wed, Aug 27, 2003 at 12:19:18PM -0500, Ron Johnson wrote:
} On Wed, 2003-08-27 at 09:53, Gregory Seidman wrote:
} > On Wed, Aug 27, 2003 at 12:43:55PM +0200, Frank Gevaerts wrote:
} > } On Wed, Aug 27, 2003 at 01:11:08AM -0500, Alex Malinovich wrote:
} > [...]
} > } First convince me that object oriented programming results in
} > } maintainable and debuggable code, then convince me that C++ is a good
} > } implementation of OO, and then I might consider C++ instead of C. (I
} > } know not all the features of C++ are related to OO, but OO seems to be
} > } the main selling point of C++ vs C)
} >
} > OO was, at one time, the primary purpose of C++ extending C. It no longer
} > is. C++ is a tolerable, if annoying, OO language but it is hardly an
} > exemplary one. It does, however, have templating and the standard library
} > (formerly the Standard Template Library, a.k.a. STL). This allows some very
} > powerful and elegant code, and provides an astoundingly flexible library of
} > common data structures and algorithms. The Boost project is working on
} > creating an even more comprehensive library (for possible inclusion into
} > the next C++ standard). It is generic programming, enabled by C++ templates
} > and OO, that give C++ it's value.
} >
} > As an example of how C tries and fails to do the same sort of thing,
} > consider the standard C qsort() function. The qsort() function is generic,
} > but lacks any sort of type safety. The C++ templated sort function provides
} > the same generic sort function, but with type safety.
}
} If you want a C-like OO language with type safety, why not use Java?

Let me clarify. What makes C++ powerful is that one can write typesafe code
that does not depend on the type being handled. Let me run that by you
again in an example. The C++ standard library's vector class allows me to
hold objects of some particular type. The source code implementing the
vector class does not care what type, but upon compilation I will be
informed if I am trying to store something of the wrong type in it.

The emphasis here is on "upon compilation." I don't get an exception at
runtime if I happen to follow a code path that results in the wrong thing
being stored (and retrieved, and cast), I get a compilation error even if
it never occurs to me to test that particular code path. It's called static
analysis, and it's damned nice when your compiler does it for you.

Java doesn't cut it. You can and often do have type errors which cannot be
discovered except by extensive runtime testing. Relying on testing alone is
a losing proposition, since the number of code paths in a program of any
reasonable size is simply intractably large.

Now, the next version of Java is expected to have templated collection
classes and such, which will give it some of that power. It will not,
however, allow templated methods (AFAIK). This is rather limiting.

Let me make it clear that I am not claiming that Java is useless, or even
worse than C++. There are purposes to which it is far more suited.
Nonetheless, I'd choose to write any user application (GUI or CLI) of any
complexity with C++, and most varieties of server as well.

} Ron Johnson, Jr. ron.l....@cox.net
--Greg

Harshwardhan Nagaonkar

unread,
Aug 27, 2003, 6:50:10 PM8/27/03
to
Steve Lamb wrote:
> On Wed, 27 Aug 2003 16:17:30 +0200
> Francois Bottin <fbo...@free.fr> wrote:
>
>>Quoting Ron Johnson <ron.l....@cox.net>:
>>
>>>On Wed, 2003-08-27 at 06:34, Paul Johnson wrote:
>>>
>>>>Wouldn't it be easier to read if you wrote it s/C/Perl/ ?
>
>
>>>So that it wouldn't change Choo-choo to Perlhoo-choo. I wasn't
>>>just thinking of that one paragraph...
>
>
>>Then: s/\bC\b/Perl/g ;-)
>>(Yes, I also added a g at the end to not only substitute the 1st occurence)
>
>
> Still doesn't work when sentences end in C.
>
Hahaha. It always amuses me whenever we have a thread about a particular
topic, which refrences a particular search-and-replace command. Various
other people reply and give examples with which the said
search-and-replace command will not work; and then give their own
versions of the command.

All that said, isn't there like a "One True Search-and-replace Command"
which will handle all this weirdness of characters being at the
start/middle/end of words which should not be replaced? This is just an
informative question though (I hope it doesn't end like an unproductive
Vi Vs. Emacs sort of discussion). =)

--
Harshwardhan Nagaonkar
Electrical Engineering Sysop
Brigham Young University - 84602

Pigeon

unread,
Aug 27, 2003, 6:50:17 PM8/27/03
to
On Wed, Aug 27, 2003 at 04:27:15AM -0700, Paul Johnson wrote:

> On Tue, Aug 26, 2003 at 11:54:58PM -0700, Loren M Lang wrote:
> > If people don't learn C before C++, it A) a little harder to learn
> > properly, and B) it's harder for them to learn other languages later like
> > C, Objective C, and Dynamic C with are all C dirivatives.

>
> While I haven't learned much C yet (I can read it better than I write
> it), I do have to ask this one: It's possible to write

> non-braindamaged code in C++ without learning C first?

I would suggest it may well be easier to write good C++ if you don't
know C first. It seems that it's not quite as similar as the name
would have it, and habits learned which are reliable in C can get you
into trouble in C++ - see thread about C++ memory allocation and
dancing pointers, a few weeks back.

C is a "dirty" language. It's great for low-level stuff, bit
twiddling, messing around with hardware and stuff, which is much more
difficult in other HLLs, as well as being equally capable of the
higher-level stuff with other HLLs of the era. Assembler programmers
like C; it's been called things like "cross between an HLL and a macro
assembler". There is a certain strange beauty in writing a chunk of C
code and seeing hanging in the air beside it the opcodes for a really
neat tight bit of assembler into which the C very directly translates
(and a concomitant despair if you then have a look at what the real
compiler actually produces...) There's all that wonderful pointer
stuff, and you can write things like

switch (a) {
case 0: if (b==c) {
case 1: do_case_1();
break;
} else {
case 2: do_case_2();
break;
}
}

C programmers hate Pascal. Trying to switch from C to even a
real-world variant of Pascal with equivalent functionality - eg.
switching between equivalent releases of Turbo C and Turbo Pascal in
DOS - is *horrible*. You keep thinking "stupid bloody toy language,
can't do this, won't let me do that"... University teaching Pascal is
even worse - no string handling, no decent file I/O, no nothing much...

C++ is the bastard mongrel offspring of good old C and a bunch of
academic theoretical 80s-Thatcherite-type style gurus masturbating in
committee. Object oriented programming is cool! Strong typing is cool!
Being a programmer with short hair and a tie is cool! Meanwhile, in
the real world, more and more computers were running C code written by
long-haired C programmers who smoked lots of grass. C++, the PC
explosion and the apparent extreme fitness of OOP for Windoze-style
interfaces are all part of a plot to destroy creativity and free
thinking among programmers by getting them out of their smoky back
rooms and making them wear suits and sit in open-plan offices with
plastic plants programming boring business stuff, drinking bottled
water instead of coffee and using coke instead of grass. Reduce the
availability of jobs hacking Unix in a den somewhere, replace them
with jobs hacking DOS on PCs, but still using assembler and C. Then
introduce extensions on newer compiler versions; call it C++ and make
the syntax really complicated to fool people it's still more or less
C, but slip in restrictions more straitjacketing than Pascal. Provide
few/crappy windowing functions, so the first thing people have to do
is extend/hack/patch/write their own, and get all happy about using
the OOP features. Once they've finished sorting out the libraries and
have to write the rest of their app and find what a bummer it is cos
it's all pascally now, it's TOO LATE. They'll all be addicted to coke
and Porsches and kissing the system's arse because they're shit scared
of not being able to pay the mortgage. And they won't even notice the
plot because they'll think it's all "the march of technology".
HAHAHAHAAAAA!!!!!

With the old guard apparently neutralised, a number of factors changed
the scene from Orwellian to more Huxleian. The generation now leaving
schools and colleges had been taught from primary school to value
style over content, the Illuminati and Masons ceased to back up
Thatcher and Reagan and switched support to the Intel/Microsoft axis.
Computers became ever cheaper and more widespread; programming
environments like Windoze / Visual Basic came out, in which all the
hard/interesting work has been taken care of and programming simple
applications is a case of join the dots, point and drool and draw some
pretty pictures, but programming complex or low-level applications is
impossible, and must be left to the indoctrinated, controlled herds at
the big corps, who are instantly assigned to drawing pretty pictures
if they show too many signs of creative inspiration. To mask this,
Visual C++ came out, with the safety features added of (a) continually
crashing the entire machine, not just the task and (b) the requirement
in the jobs market to have certificates of Microsoft indoctrination.
The downhill slide accelerated with HTML, graphical browsers,
Javascript and Flash.

The flaw in this scheme was the intellectual crippling of the
programmers at the big corps, which had the inevitable result that PCs
needed to be of mainframe power to run their creations, which then
proceeded to crash all the time. This had two consequences. One was
that the remnants of the old guard and their spiritual descendants -
for creativity can never be entirely suppressed - were in an ideal
position to pour their creative energies into alternatives to the
Microsoft system, designed to facilitate rather than obscure the art
of coding for them, similarly to facilitate the solution of problems,
and not to crash all the time. Foremost among these was one Linus
Torvalds, who created the kernel known as Linux that finally broke
the Microsoft dependency and enabled the spread of a free, Unix-like
operating system. The further dependency on Intel was broken by the
Debian Project who took an interest in porting Linux to as many
different architectures as possible.

The other consequence was that bored teenagers who used to hang around
in the streets and smash up bus stops, now hung around in their
bedrooms with computers, which they used to electronically smash up
other people's computers. The poor quality of Microsoft software made
this laughably easy, and viruses, worms and other pathological
software proliferated rapidly. Their spread was helped by the strategy
of keeping people as ignorant as possible about the workings of their
computers, so they were long unaware of infection and passed it on
widely.

An early indication of the potential consequences of this situation
was the major power blackout in the US which, it was eventually
leaked, had been caused by a virus attacking the Microsoft systems
used by the power distribution network; the leak itself was caused by
a second virus broadcasting random documents from the company's
internal network to random email addresses. Shortly after this the
White House was severely damaged when computers controlling the sewage
network succumbed to viral attack, pumps went into reverse, raw sewage
pumped out of toilet pans and the accompanying methane exploded. The
President, fleeing the foul flood, was hit by a fragment of flying
debris; fortunately for him, it hit him in the ear, and so was able to
pass through and out of the other ear with minimal injury. In the same
week the 'Shining Sun' virus, which exploited a flaw in certain
laptops to turn up the power to the screen backlight to dangerous
levels, achieved notoriety in the UK when the backlight in Tony
Blair's laptop exploded, knocking him unconscious into the Thames; he
was only saved by the buoyancy of his cranial airspace.

The tide really turned in Russia after an exploit against Microsoft
Powerpoint caused Vladimir Putin's presentation to the United Nations
to inform the assembled delegates that their mother was a hamster and
their father smelt of elderberries. A purge on all Microsoft products
followed and several million Windoze CDs were ceremonially burned in
front of the Kremlin. Bill Gates despatched himself to Russia to try
and restore Microsoft's fortunes; his limousine stalled on a level
crossing; the driver escaped, but the rear doors apparently jammed and
Gates was crushed by a train. Within months every computer in Russia
was running Linux, computer dysfunctionality dropped to minimal levels
and the effect on Russia's economy was such that the West was forced
to follow their example. The change was slow initially, but once
enough Western organisations had installed Linux that its success was
shown to be no peculiarity of Russia, market forces did the rest, and
Microsoft disintegrated.

Oops, sorry, we haven't got that far yet...

--
Pigeon

Be kind to pigeons
Get my GPG key here: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x21C61F7F

Alex Malinovich

unread,
Aug 27, 2003, 7:00:17 PM8/27/03
to
Дана сре, 27-08-2003 у 13:06, Steve Lamb је написао:
> On Wed, 27 Aug 2003 04:21:05 -0700
> Paul Johnson <ba...@ursine.ca> wrote:
> > It's relatively easy to learn, plus everybody else in the unix world
> > uses C. It's portable. It helps to know your history: C was created
> > to write unix to begin with.
>
> *cough, spit* I was able to grasp Turbo Pascal far before C. I had no
> problems with Perl. Hell, I learned Python in a week. C.. C I still poke at
> with a 2' stick in the eye and hope it goes away and I've taken several
> classes in C and have tried to work with it several times over the years.

Turbo Pascal was the first ever language I worked with. I also love
Perl. And, as I've said before, not counting the non-free issues, I love
Java. I've done some C++ work (which is actually what prompted this
question in the first place) but I've never quite gotten comfortable
with C. I'm also very reluctant to learn Python because I'm very adamant
in how I use whitespace. Though I will need to pick it up sooner later.
As well as Ruby and probably PHP as well. You can never know too many
languages after all. :)

--
Alex Malinovich
Support Free Software, delete your Windows partition TODAY!
Encrypted mail preferred. You can get my public key from any of the
pgp.net keyservers. Key ID: A6D24837

signature.asc

Deryk Barker

unread,
Aug 27, 2003, 7:00:19 PM8/27/03
to
Thus spake Steve Lamb (gr...@dmiyu.org):

> On Wed, 27 Aug 2003 04:21:05 -0700
> Paul Johnson <ba...@ursine.ca> wrote:
> > It's relatively easy to learn, plus everybody else in the unix world
> > uses C. It's portable. It helps to know your history: C was created
> > to write unix to begin with.
>
> *cough, spit* I was able to grasp Turbo Pascal far before C. I had no
> problems with Perl. Hell, I learned Python in a week. C.. C I still poke at
> with a 2' stick in the eye and hope it goes away and I've taken several
> classes in C and have tried to work with it several times over the years.

Nor does it help that the best-selling C book ever is, ahem,
less-than-superbly-written.

Incidentally Paul, C was derived from B (derived from BCPL) in order
to *re*write Unix, which was originally written in assembler.

--
|Deryk Barker, Computer Science Dept. | Music does not have to be understood|
|Camosun College, Victoria, BC, Canada| It has to be listened to. |
|email: dba...@camosun.bc.ca | |
|phone: +1 250 370 4452 | Hermann Scherchen. |

Alfredo Valles

unread,
Aug 27, 2003, 7:20:09 PM8/27/03
to
On Wednesday 27 August 2003 7:45 pm, Deryk Barker wrote:
> Thus spake Ron Johnson (ron.l....@cox.net):
> > On Wed, 2003-08-27 at 04:06, Alfredo Valles wrote:
>
> ....
>
> > > > Python!!!!!!!!!! Object oriented, and methods that need speed are
> > > > wrapped around C.
> > >
> > > And very very slow too, like any other script language.
> >
> > One thing I learned a *long* time ago is that even an 80286 is faster
> > than people typing, reading the screen, moving the mouse, getting a
> > cup of coffee, etc.
>
> Yes, I'd be interested in knowing why python should be considered
> "very very slow". I've been using it extensively for several years and
> have had no performance issues.


Well, I like speed cause I make some computer intensive work.
One of the first examples I saw of python was a simple program that find the
prime numbers under X limit. I compared the time with a similar code in C and
the difference is big.

I'm not criticizing python, I mean all scripting is slow compared to compiled
programs execution. I'm sure python have a bright future.


>
> > > I like python, there are several techniques to accelerate python (like
> > > weave and psyco) but for a good speed C is the best.
> >
> > Don't forget NumPy.
>
> Or SWIG. C may be best for "good speed" wrt execution, but in terms of
> development time.....

One thing I don't understand is why if python code can be so accelerated with
psyco and you have to do nothing for it to work they have not included psyco
as a default option in python. That would bust python a lot.
Someone may enlight me about it?


Alfredo

Ron Johnson

unread,
Aug 27, 2003, 7:50:06 PM8/27/03
to
On Wed, 2003-08-27 at 14:56, Diego Calleja García wrote:
> El Wed, 27 Aug 2003 01:11:08 -0500 Alex Malinovich <demo...@the-love-shack.net> escribió:
>
>
> > C comes in. Yet I see people writing 'modern' GUI applications and using
> > C when I would think C++ would be a much better choice. Is there
> > something that I'm missing? Something that C actually does better than
> > C++ in regards to higher-level functions?
>
> Performance (aka "bloatage") (just run openoffice, kde...)

KDE is pretty fast, and the MS VC++ generates excellent binaries.

> (Yeah, some people can get good performance because they're good c++ coders.
> Probably it's not even a 1% of all c++ coders though)
>
> Another reason: great C compilers. (yeah, c++ is getting better...)

--

-----------------------------------------------------------------
Ron Johnson, Jr. ron.l....@cox.net
Jefferson, LA USA

"What other evidence do you have that they are terrorists, other
than that they trained in these camps?"
17-Sep-2002 Katie Couric to an FBI agent regarding the 5 men
arrested near Buffalo NY

Steve Lamb

unread,
Aug 27, 2003, 8:20:10 PM8/27/03
to
On Wed, 27 Aug 2003 16:01:48 -0500
Alex Malinovich <demo...@the-love-shack.net> wrote:
> I'm also very reluctant to learn Python because I'm very adamant
> in how I use whitespace. Though I will need to pick it up sooner later.
> As well as Ruby and probably PHP as well. You can never know too many
> languages after all. :)

That was one of two points that really stuck in my craw about Python. But
ya know what? 2+ years later and now I go back to Perl code or poke through C
code and I just find it nasty to paw through. And writing either of those,
oy, don't even get me started. It's definitely something to get used to and
the more used to doing things with block delimiters the more friction there is
to doing it any other way. But I'd not go back and I wish other languages
would take the same path.

Pigeon

unread,
Aug 27, 2003, 8:20:12 PM8/27/03
to
On Wed, Aug 27, 2003 at 04:17:30PM +0200, Francois Bottin wrote:
> Then: s/\bC\b/Perl/g ;-)

...it matches the separators, but it doesn't replace them...

Cool! I've been after that trick for ages. Thanks!

Gregory Seidman

unread,
Aug 27, 2003, 8:20:14 PM8/27/03
to
On Wed, Aug 27, 2003 at 10:02:44PM +0200, Thomas Krennwallner wrote:
} On Wed Aug 27, 2003 at 12:02:23PM -0500, Michael Heironimus wrote:
} > It doesn't matter how good or bad Java, C, or any other language might
} > be. What counts is who's backing it, what you can do with it, and how
} > fast you can do it (how good the development tools are, how much of of
} > that code you already have, etc.). How important each of those is
} > depends on where you are and who you're talking to. A lot of times the
} > decision isn't even based on sound technical advice, just on company
} > politics, product marketing, and short-term cost.
}
} And that all doesn't matter if you're a free software developer...
} You use the tools YOU like, the language YOU think is the right one for
} your project and don't have to give a damn about other opinions why this
} or that language has to be better than the other.

...unless you are trying to build up a community of contributors around
your project, in which case you had better use a language that people who
are likely to want to contribute are likely to know. In that case, whatever
has taken the world by storm is probably a good choice, assuming it is even
a reasonable fit to the task.

[...]


} For me its clear: use the language you think is good for completing a
} given task. I know you cannot always make this decision but if you have
} the chance, choose carefully ;-)

Well said.

} So long
} Thomas
--Greg

Yves Goergen

unread,
Aug 27, 2003, 8:30:17 PM8/27/03
to
Von: "Harshwardhan Nagaonkar" <ha...@ee.byu.edu>

> Hahaha. It always amuses me whenever we have a thread about a particular
> topic, which refrences a particular search-and-replace command. Various
> other people reply and give examples with which the said
> search-and-replace command will not work; and then give their own
> versions of the command.
>
> All that said, isn't there like a "One True Search-and-replace Command"
> which will handle all this weirdness of characters being at the
> start/middle/end of words which should not be replaced? This is just an
> informative question though (I hope it doesn't end like an unproductive
> Vi Vs. Emacs sort of discussion). =)
>

right. i was wondering, not long ago, if there's a possibility to merge both parameters of the 'rename' shell script into one and port all this to, say, windows. there are many situations where such a tool would make my life a bit easier...

from what i understood, you can give a perl-like replace command like /find/replace/ and a file filter to select the files to apply this on, like *.txt.

why can't one just make something like /(find.*)\.txt/replace_<uppercase of \1>_<counter>\.txt/
hmm, you got the point?

or were i just sleeping too long and this actually IS possible?

btw, can i do this perl replaces with the pcre library, too? (not inside perl, of course.) if yes, could anyone explain this to me please?

--
Yves Goergen
nospa...@unclassified.de
Please don't CC me (causes double mails)

Colin Watson

unread,
Aug 27, 2003, 9:00:21 PM8/27/03
to
On Wed, Aug 27, 2003 at 05:34:39PM +0200, Alfredo Valles wrote:
> One thing I don't understand is why if python code can be so
> accelerated with psyco and you have to do nothing for it to work they
> have not included psyco as a default option in python. That would bust
> python a lot.
> Someone may enlight me about it?

psyco is not yet portable to anything other than i386.

--
Colin Watson [cjwa...@flatline.org.uk]

Colin Watson

unread,
Aug 27, 2003, 9:10:08 PM8/27/03
to
On Wed, Aug 27, 2003 at 01:59:57PM -0700, Deryk Barker wrote:
> Thus spake Steve Lamb (gr...@dmiyu.org):
> > *cough, spit* I was able to grasp Turbo Pascal far before C. I
> > had no problems with Perl. Hell, I learned Python in a week. C.. C
> > I still poke at with a 2' stick in the eye and hope it goes away and
> > I've taken several classes in C and have tried to work with it
> > several times over the years.
>
> Nor does it help that the best-selling C book ever is, ahem,
> less-than-superbly-written.

Which one's that, then?

--
Colin Watson [cjwa...@flatline.org.uk]

Paul M Foster

unread,
Aug 27, 2003, 10:00:15 PM8/27/03
to
On Wed, Aug 27, 2003 at 01:11:08AM -0500, Alex Malinovich wrote:

> The recent COBOL discussion has gotten me to thinking. Some languages
> seem to be very popular in some situations. C is easily the dominant
> language for most things Linux. So therein lies the question. Why,
> exactly, is C so popular? Especially in comparison to C++. I can't think
> of a single reason to use C instead of C++ for most of the coding that I
> would do. I generally only write user applications. I don't get anywhere
> near the kernel which is where I'd imagine most of the reason for using


> C comes in. Yet I see people writing 'modern' GUI applications and using
> C when I would think C++ would be a much better choice. Is there
> something that I'm missing? Something that C actually does better than
> C++ in regards to higher-level functions?

1) Most programmers know C already. C++ is a late-comer. It's easier to
code in what you know than learn a new language and then code something.

2) C allows you to get down to "bare metal". This is important in a lot
of applications, particularly in kernel work.

3) C++ is slower. Don't argue-- it is, particularly if you're using
templates and such. It may not make much difference in user apps, but
for kernel work, that's critical. And it take three times longer to
compile anything of reasonable complexity in C++.

<rant>

4) C++ is unbelievably complex compared to C. Here's why I know this. I
originally learned Dartmouth (mainframe) BASIC back in 1975. Later, I
got a PC and learned Turbo Pascal. Then, I decided to learn a "real"
programming language. (Pascal was designed to _teach_ programming.) So I
learned C. This was after a survey of Fortran, COBOL, PL/1, APL, Algol
and others. In the last few years, I switched over to C++. I have never
taken so long to write programs in my entire life as when I was coding
in C++. I spent far more time in design, and far more time debugging
than I ever had in C. So I went back to C. Now my C code looks like
a C++ programmer wrote it. But it's quicker to write.

Plus, I don't and never have liked the iostreams. They're clunky
compared to printf() for most things. And exceptions are a pain in the
butt, and no one seems to have a definitive answer on when to and when
not to use them.

Classes I love and inheritance I liked. But the public/private/protected
distinction in inherited classes is a pain to design and maintain. Plus
vtables and virtual classes and functions. And friend classes/functions.
C++ was supposed to allow a lot of code reuse. I haven't seen it, and I
don't think any language will ever practically deliver it.

</rant>

Paul

Mark Roach

unread,
Aug 27, 2003, 10:10:17 PM8/27/03
to
On Wed, 2003-08-27 at 18:46, Gregory Seidman wrote:
> On Wed, Aug 27, 2003 at 10:02:44PM +0200, Thomas Krennwallner wrote:
[...]

> }
> } And that all doesn't matter if you're a free software developer...
> } You use the tools YOU like, the language YOU think is the right one for
> } your project and don't have to give a damn about other opinions why this
> } or that language has to be better than the other.
>
> ...unless you are trying to build up a community of contributors around
> your project, in which case you had better use a language that people who
> are likely to want to contribute are likely to know. In that case, whatever
> has taken the world by storm is probably a good choice, assuming it is even
> a reasonable fit to the task.

Good point. Sawfish was essentially maintainerless for quite some time
due in large part to a lack of developers familiar with lisp, or maybe
it was the particular dialect of lisp (scheme?, rep?). I would imagine
that projects written in fortran/tcl/ruby would also have fewer people
in the community with the experience to contribute than comparable
programs written in C/Perl/Python.

Not that it detracts from the value of the languages themselves, just
that, for community-driven projects, finding a large(ish) potential
community is probably a good idea.

At the risk of branching off in a bad direction, I sometimes wonder
whether multi-language environments like .net and (someday) parrot will
alleviate or aggravate this sort of problem. I can just imagine horrible
programming monstrosities written partly in perl, partly in tcl, python,
C, and java.

Boy, that was a ramble, need more sudafed :-)

-Mark

Ron Johnson

unread,
Aug 27, 2003, 10:40:15 PM8/27/03
to
On Wed, 2003-08-27 at 15:59, Deryk Barker wrote:
> Thus spake Steve Lamb (gr...@dmiyu.org):
>
> > On Wed, 27 Aug 2003 04:21:05 -0700
> > Paul Johnson <ba...@ursine.ca> wrote:
> > > It's relatively easy to learn, plus everybody else in the unix world
> > > uses C. It's portable. It helps to know your history: C was created
> > > to write unix to begin with.
> >
> > *cough, spit* I was able to grasp Turbo Pascal far before C. I had no
> > problems with Perl. Hell, I learned Python in a week. C.. C I still poke at
> > with a 2' stick in the eye and hope it goes away and I've taken several
> > classes in C and have tried to work with it several times over the years.
>
> Nor does it help that the best-selling C book ever is, ahem,
> less-than-superbly-written.
>
> Incidentally Paul, C was derived from B (derived from BCPL) in order
> to *re*write Unix, which was originally written in assembler.

Another goal of C was to make it look like PDP-11 assembly.

Which is why C is sometimes called a 2.5GL language, to distinguish
it from 3GLs like, oh, every other procedural language except Assembly
(which is 2GL, after all).

--
-----------------------------------------------------------------
Ron Johnson, Jr. ron.l....@cox.net
Jefferson, LA USA

"Man, I'm pretty. Hoo Hah!"
Johnny Bravo

Ron Johnson

unread,
Aug 27, 2003, 10:50:12 PM8/27/03
to
On Wed, 2003-08-27 at 10:34, Alfredo Valles wrote:
> On Wednesday 27 August 2003 7:45 pm, Deryk Barker wrote:
> > Thus spake Ron Johnson (ron.l....@cox.net):
> > > On Wed, 2003-08-27 at 04:06, Alfredo Valles wrote:
> >
> > ....
> >
> > > > > Python!!!!!!!!!! Object oriented, and methods that need speed are
> > > > > wrapped around C.
> > > >
> > > > And very very slow too, like any other script language.
> > >
> > > One thing I learned a *long* time ago is that even an 80286 is faster
> > > than people typing, reading the screen, moving the mouse, getting a
> > > cup of coffee, etc.
> >
> > Yes, I'd be interested in knowing why python should be considered
> > "very very slow". I've been using it extensively for several years and
> > have had no performance issues.
>
>
> Well, I like speed cause I make some computer intensive work.
> One of the first examples I saw of python was a simple program that find the
> prime numbers under X limit. I compared the time with a similar code in C and
> the difference is big.
>
> I'm not criticizing python, I mean all scripting is slow compared to compiled
> programs execution. I'm sure python have a bright future.

If you need *every last millimeter/sec* of speed, then yes, stick
with a pure compiled language with hyper-tweaked libraries, and a
compiler better than gcc.

However, if development time and bug minimization is equally as
important, stick with Python.

--
-----------------------------------------------------------------
Ron Johnson, Jr. ron.l....@cox.net
Jefferson, LA USA

"Our computers and their computers are the same color. The
conversion should be no problem!"
Unknown

Ron Johnson

unread,
Aug 27, 2003, 10:50:13 PM8/27/03
to
On Wed, 2003-08-27 at 16:01, Alex Malinovich wrote:
> Дана сре, 27-08-2003 у 13:06, Steve Lamb је написао:
> > On Wed, 27 Aug 2003 04:21:05 -0700
> > Paul Johnson <ba...@ursine.ca> wrote:
[snip]

> with C. I'm also very reluctant to learn Python because I'm very adamant
> in how I use whitespace. Though I will need to pick it up sooner later.

<innocently> Why Alex, whatever do you mean by that?

--
-----------------------------------------------------------------
Ron Johnson, Jr. ron.l....@cox.net
Jefferson, LA USA

"As the night fall does not come at once, neither does
oppression. It is in such twilight that we must all be aware of
change in the air - however slight - lest we become unwitting
victims of the darkness."
Justice William O. Douglas

Ron Johnson

unread,
Aug 27, 2003, 11:00:14 PM8/27/03
to
On Wed, 2003-08-27 at 18:12, Paul M Foster wrote:
> On Wed, Aug 27, 2003 at 01:11:08AM -0500, Alex Malinovich wrote:
[snip]

> in C++. I spent far more time in design, and far more time debugging
> than I ever had in C. So I went back to C. Now my C code looks like

<SARCASM>
Aghhhhhh!!! He spent lot's of time designing software!!!!!!! Run,
hide!!!! The world is coming to an end!!!!!!!!!!!!
</SARCASM>

Seriously, though, OO languages, being born of academia, were designed
*not* to be quick-'n-dirty languages. They were designed with
large projects in mind (the whole Software Design Life Cycle bit).

If you want a (IMHO) good mix between QnD and OO, try Python. It
is totally comfortable with procedural coding and OO coding.

--
-----------------------------------------------------------------
Ron Johnson, Jr. ron.l....@cox.net
Jefferson, LA USA

"Our computers and their computers are the same color. The

conversion should be no problem!"
Unknown

Steve Lamb

unread,
Aug 27, 2003, 11:00:20 PM8/27/03
to
On Wed, 27 Aug 2003 21:53:26 -0500
Ron Johnson <ron.l....@cox.net> wrote:
> Seriously, though, OO languages, being born of academia, were designed
> *not* to be quick-'n-dirty languages. They were designed with
> large projects in mind (the whole Software Design Life Cycle bit).

Oh how I would love to find who came up with that particular catch phrase
and retort with my 10.5's in the posterior of said person.



> If you want a (IMHO) good mix between QnD and OO, try Python. It
> is totally comfortable with procedural coding and OO coding.

Ohhhh yeah. To me coding is organic. I know what I want the program to
do, I dunno how to get there. Actually doing helps me think and see where to
go. Ya get this working, then you branch out and do this. In the process
this doesn't work so you tweak it a little. The whole notion of designing the
program before you program it seems odd because programming is designing IMHO.

Thomas Krennwallner

unread,
Aug 27, 2003, 11:20:09 PM8/27/03
to
Hi!

On Wed Aug 27, 2003 at 07:12:35PM -0400, Paul M Foster wrote:
> and others. In the last few years, I switched over to C++. I have never
> taken so long to write programs in my entire life as when I was coding
> in C++. I spent far more time in design, and far more time debugging
> than I ever had in C. So I went back to C. Now my C code looks like
> a C++ programmer wrote it. But it's quicker to write.
>
> Plus, I don't and never have liked the iostreams. They're clunky
> compared to printf() for most things. And exceptions are a pain in the
> butt, and no one seems to have a definitive answer on when to and when
> not to use them.
>
> Classes I love and inheritance I liked. But the public/private/protected
> distinction in inherited classes is a pain to design and maintain. Plus
> vtables and virtual classes and functions. And friend classes/functions.
> C++ was supposed to allow a lot of code reuse. I haven't seen it, and I
> don't think any language will ever practically deliver it.

Go and read "Design Patterns: Elements Of Reusable Object-Oriented
Software"[1]. It's THE book for developers who think like you. He, I was
in your group, but after reading this book I was enlightened ;-)

So long
Thomas

1. http://c2.com/cgi/wiki?DesignPatternsBook

Deryk Barker

unread,
Aug 27, 2003, 11:20:09 PM8/27/03
to
Thus spake Steve Lamb (gr...@dmiyu.org):

> On Wed, 27 Aug 2003 16:01:48 -0500


> Alex Malinovich <demo...@the-love-shack.net> wrote:
> > I'm also very reluctant to learn Python because I'm very adamant
> > in how I use whitespace. Though I will need to pick it up sooner later.
> > As well as Ruby and probably PHP as well. You can never know too many
> > languages after all. :)
>
> That was one of two points that really stuck in my craw about Python. But
> ya know what? 2+ years later and now I go back to Perl code or poke through C
> code and I just find it nasty to paw through. And writing either of those,
> oy, don't even get me started. It's definitely something to get used to and
> the more used to doing things with block delimiters the more friction there is
> to doing it any other way. But I'd not go back and I wish other languages
> would take the same path.

I agree 100%, although it was my encounter with Miranda c1986 that
first prompted the "I'll indent how I like" reaction.

But you are right, having to indent properly produces much
cleaner-looking and easier to maintain code.

And I really appreciate the latter after having spent several hours on
afternoon about 15 years ago trying to find a bug in a C program (not
written by me), and missing it because poor and inconsistent
indentation by the original author made me misread the code.

After I found the bug the next task I set myself,, before doing
anything else, was to indent his code properly. All went much better
after that.

I also think that enforced indentation is a very good thing in a
language used to teach programming - one of the things that makes
python so good for that, in fact.

--
|Deryk Barker, Computer Science Dept. | Music does not have to be understood|
|Camosun College, Victoria, BC, Canada| It has to be listened to. |
|email: dba...@camosun.bc.ca | |
|phone: +1 250 370 4452 | Hermann Scherchen. |

Mike Mueller

unread,
Aug 27, 2003, 11:40:08 PM8/27/03
to
On Wednesday 27 August 2003 19:12, Paul M Foster wrote:
> Plus, I don't and never have liked the iostreams. They're clunky
> compared to printf() for most things. And exceptions are a pain in the
> butt, and no one seems to have a definitive answer on when to and when
> not to use them.

Amen brother! I've done formated output with iostreams and it's like you say
- clunky. iostreams didn't make things better, it made them diferent - like
I need more crap in my head.

--
Mike Mueller
324881 (08/20/2003)
Make clockwise circles on the floor with your right foot; now, without
looking at your foot, use the index finger on your right hand to draw the
number "6" in the air

Ron Johnson

unread,
Aug 27, 2003, 11:40:08 PM8/27/03
to
On Wed, 2003-08-27 at 20:58, Mark Roach wrote:
> On Wed, 2003-08-27 at 18:46, Gregory Seidman wrote:
> > On Wed, Aug 27, 2003 at 10:02:44PM +0200, Thomas Krennwallner wrote:
> [...]
> > }
> > } And that all doesn't matter if you're a free software developer...
> > } You use the tools YOU like, the language YOU think is the right one for
> > } your project and don't have to give a damn about other opinions why this
> > } or that language has to be better than the other.
> >
> > ...unless you are trying to build up a community of contributors around
> > your project, in which case you had better use a language that people who
> > are likely to want to contribute are likely to know. In that case, whatever
> > has taken the world by storm is probably a good choice, assuming it is even
> > a reasonable fit to the task.
>
> Good point. Sawfish was essentially maintainerless for quite some time
> due in large part to a lack of developers familiar with lisp, or maybe
> it was the particular dialect of lisp (scheme?, rep?). I would imagine

The same thing is happening now with gnucash, which is partly written
in Guile.
Guile is a Scheme implementation designed for real world programming,
providing a rich Unix interface, a module system, an interpreter, and
many extension languages. Guile can be used as a standard #! style
interpreter, via #!/usr/bin/guile, or as an extension language for
other applications via libguile.

> that projects written in fortran/tcl/ruby would also have fewer people
> in the community with the experience to contribute than comparable
> programs written in C/Perl/Python.
>
> Not that it detracts from the value of the languages themselves, just
> that, for community-driven projects, finding a large(ish) potential
> community is probably a good idea.
>
> At the risk of branching off in a bad direction, I sometimes wonder
> whether multi-language environments like .net and (someday) parrot will
> alleviate or aggravate this sort of problem. I can just imagine horrible
> programming monstrosities written partly in perl, partly in tcl, python,
> C, and java.

Decades ago, DEC published the DSRI (Digital Standard Run-time
Interface) for VMS. Thus, object files generated by the compiler
of any language that follows the DSRI spec (all of DEC/Compaq/HP's
compilers, of course, including C/C++, COBOL, FORTRAN, BASIC, Ada,
DIBOL, Bliss, MACRO, Pascal, etc, and compliant 3rd-party compilers)
can, and do, all link together into 1 executable.

As with most other of it's ideas, others are *finally* catching
up with DEC: GNU is, I believe, trying to do something similar with
the gnu compiler collection.

--
-----------------------------------------------------------------
Ron Johnson, Jr. ron.l....@cox.net
Jefferson, LA USA

Thanks to the good people in Microsoft, a great deal of the data
that flows is dependent on one company. That is not a healthy
ecosystem. The issue is that creativity gets filtered through
the business plan of one company.
Mitchell Baker, "Chief Lizard Wrangler" at Mozilla

Ron Johnson

unread,
Aug 27, 2003, 11:40:09 PM8/27/03
to

But as you just demonstrated, regularized indenting is crucial to
any code bigger than, oh, say, a 25-liner.

--
-----------------------------------------------------------------
Ron Johnson, Jr. ron.l....@cox.net
Jefferson, LA USA

"What other evidence do you have that they are terrorists, other

than that they trained in these camps?"
17-Sep-2002 Katie Couric to an FBI agent regarding the 5 men
arrested near Buffalo NY

Ron Johnson

unread,
Aug 27, 2003, 11:50:07 PM8/27/03
to
On Wed, 2003-08-27 at 21:58, Steve Lamb wrote:
> On Wed, 27 Aug 2003 21:53:26 -0500
> Ron Johnson <ron.l....@cox.net> wrote:
> > Seriously, though, OO languages, being born of academia, were designed
> > *not* to be quick-'n-dirty languages. They were designed with
> > large projects in mind (the whole Software Design Life Cycle bit).
>
> Oh how I would love to find who came up with that particular catch phrase
> and retort with my 10.5's in the posterior of said person.

After having worked in a shop that gave only lip service to the
SDLC, I can guarantee you that in large projects, it is *absolutely*
*positively* 115% necessary. In management's rush to kiss the
customer's arse and promise the world, next week, we were forced
to create some Really Bad C, and had to spend years correcting it,
while also generating new sub-systems and enhancing the old stuff.

> > If you want a (IMHO) good mix between QnD and OO, try Python. It
> > is totally comfortable with procedural coding and OO coding.
>
> Ohhhh yeah. To me coding is organic. I know what I want the program to
> do, I dunno how to get there. Actually doing helps me think and see where to
> go. Ya get this working, then you branch out and do this. In the process
> this doesn't work so you tweak it a little. The whole notion of designing the
> program before you program it seems odd because programming is designing IMHO.

That's called bottom-up coding. I prefer it myself, after I've
roughed out a broad top-down design.

--
-----------------------------------------------------------------
Ron Johnson, Jr. ron.l....@cox.net
Jefferson, LA USA

"they love our milk and honey, but preach about another way of living"
Merle Haggard, "The Fighting Side Of Me"

Steve Lamb

unread,
Aug 28, 2003, 12:00:11 AM8/28/03
to
On Wed, 27 Aug 2003 22:42:47 -0500
Ron Johnson <ron.l....@cox.net> wrote:
> After having worked in a shop that gave only lip service to the
> SDLC, I can guarantee you that in large projects, it is *absolutely*
> *positively* 115% necessary. In management's rush to kiss the
> customer's arse and promise the world, next week, we were forced
> to create some Really Bad C, and had to spend years correcting it,
> while also generating new sub-systems and enhancing the old stuff.

I've been on the other end of the scale. I was in a shop where it was
paramount and management didn't understand that part of it was "It'll be ready
when its ready" and insisted on hard and fast deadlines. Not for customer's
sake but for internal matters.

Steve Lamb

unread,
Aug 28, 2003, 12:00:12 AM8/28/03
to
On Wed, 27 Aug 2003 22:42:47 -0500
Ron Johnson <ron.l....@cox.net> wrote:
> That's called bottom-up coding. I prefer it myself, after I've
> roughed out a broad top-down design.

Whoops, forgot this part. I will admit that this style might not be best
for library work, however. Having the interface to the external world change
dramatically is not a good thing so some design has to go into at least that
part.

bob parker

unread,
Aug 28, 2003, 12:40:05 AM8/28/03
to
On Thu, 28 Aug 2003 00:17, Dave Howorth wrote:
> >>> Unfortunately, nowadays "s/C /Perl /".
> >>
> >>Wouldn't it be easier to read if you wrote it s/C/Perl/ ?
> >
> > So that it wouldn't change Choo-choo to Perlhoo-choo.
>
> When I saw the question, I thought the obvious counter-example was so
> that it doesn't change C# to Perl# :)
>
> Now that's a frightening thought. Just what would Perl# be like?
>
> Cheers, Dave
>
> PS I'm a Luddite that refuses to learn C++. Backward compatibility with
> C was the single biggest mistake Stroustrup made.

I once wondered why all illustrations of C++ programming showed two classes,
foo and bar. The I discovered that 'fubarred' means 'fsked beyond repair'.
That is sufficient explanation.

bob parker

unread,
Aug 28, 2003, 12:40:07 AM8/28/03
to
On Wed, 27 Aug 2003 21:21, Paul Johnson wrote:
> On Wed, Aug 27, 2003 at 01:11:08AM -0500, Alex Malinovich wrote:
> > The recent COBOL discussion has gotten me to thinking. Some languages
> > seem to be very popular in some situations. C is easily the dominant
> > language for most things Linux. So therein lies the question. Why,
> > exactly, is C so popular?
>
> It's relatively easy to learn, plus everybody else in the unix world
> uses C. It's portable. It helps to know your history: C was created
> to write unix to begin with.

I thought that unix came first, then C, then unix was rewitten in C.

I still have Kernighan and Ritchie's 'The C Programming Language' first
edition. It has a Bell Telephone Labs copyright notice from 1978 and is
otherwise undated.

After some exposure to a Basic or 3, Fortran IV, and Cobol 1969?? I was
extremely excited by K&R's exposition of the language. Somewhere around the
same time I read 'Pascal - User Manual and Report' and mostly fell asleep as
I waded through it.

C is popular IMO because it is exciting. Hackers hack because they find some
problem/opportunity exciting. Consequently the two go hand in hand.

It can be as readable as cobol given a decent choice of variable names, and
no, that Hungarian Notation propagated by Microsoft does not count.
As for the naming conventions used in cobol I can only be grateful that they
were set when coding was done via 80 column punched cards, otherwise we'd
have variable names longer than those absurd sequences of escapes you
sometimes see in Perl.

C is easier to learn than shell scripting, the elements at least, much less
Perl. I personally find it quicker to code a dirty fix in C than anything
else and would not really consider shell programming for anything other than
glue for a sequence of other commands.

Just my 2 bits.

bob parker

unread,
Aug 28, 2003, 12:40:08 AM8/28/03
to
On Thu, 28 Aug 2003 01:55, Ron Johnson wrote:
> On Wed, 2003-08-27 at 04:06, Alfredo Valles wrote:
> > On Wednesday 27 August 2003 3:59 pm, Ron Johnson wrote:
> > > On Wed, 2003-08-27 at 07:15, Peter Hugosson-Miller wrote:

> > > > Frank Gevaerts wrote:
> > > > > On Wed, Aug 27, 2003 at 01:11:08AM -0500, Alex Malinovich wrote:
> > >
> > > [snip]
> > >
> > > > I think we're stuck with C and C++, so why not try to use them as
> > > > well as possible, and choose the one you really need depending on
> > > > what you want to do...

> > >
> > > Python!!!!!!!!!! Object oriented, and methods that need speed are
> > > wrapped around C.
> >
> > And very very slow too, like any other script language.
>
> One thing I learned a *long* time ago is that even an 80286 is faster
> than people typing, reading the screen, moving the mouse, getting a
> cup of coffee, etc.

If you are using some graphical interface it just isn't faster at all. Dos
based programs were though, we had to get into Pentiums before Windows
proggies were up to what we had on the 286.

Steve Lamb

unread,
Aug 28, 2003, 1:00:12 AM8/28/03
to
On Thu, 28 Aug 2003 13:57:50 +1000
bob parker <bob_p...@dodo.com.au> wrote:
> If you are using some graphical interface it just isn't faster at all. Dos
> based programs were though, we had to get into Pentiums before Windows
> proggies were up to what we had on the 286.

Windows, yes. OS/2 v3.0 and higher, no.

Paul M Foster

unread,
Aug 28, 2003, 2:00:19 AM8/28/03
to
On Thu, Aug 28, 2003 at 05:08:08AM +0200, Thomas Krennwallner wrote:

> Hi!
>
> On Wed Aug 27, 2003 at 07:12:35PM -0400, Paul M Foster wrote:
> > and others. In the last few years, I switched over to C++. I have never
> > taken so long to write programs in my entire life as when I was coding
> > in C++. I spent far more time in design, and far more time debugging
> > than I ever had in C. So I went back to C. Now my C code looks like
> > a C++ programmer wrote it. But it's quicker to write.
> >
> > Plus, I don't and never have liked the iostreams. They're clunky
> > compared to printf() for most things. And exceptions are a pain in the
> > butt, and no one seems to have a definitive answer on when to and when
> > not to use them.
> >
> > Classes I love and inheritance I liked. But the public/private/protected
> > distinction in inherited classes is a pain to design and maintain. Plus
> > vtables and virtual classes and functions. And friend classes/functions.
> > C++ was supposed to allow a lot of code reuse. I haven't seen it, and I
> > don't think any language will ever practically deliver it.
>
> Go and read "Design Patterns: Elements Of Reusable Object-Oriented
> Software"[1]. It's THE book for developers who think like you. He, I was
> in your group, but after reading this book I was enlightened ;-)
>

I have it on my shelf and have used it from time to time. Good book. But
it contains a lot of examples of exactly what I'm talking about. "Okay,
so you want the interface to this class to be defined by this other
class, which...." Argh.

I hope you didn't mention that book to make a point about reusable code,
because it doesn't present any reusable code. "Patterns" yes. "Reusable
code" no.

Jacob Anawalt

unread,
Aug 28, 2003, 2:00:22 AM8/28/03
to
Alex Malinovich wrote:

>The recent COBOL discussion has gotten me to thinking. Some languages
>seem to be very popular in some situations. C is easily the dominant
>language for most things Linux. So therein lies the question. Why,

>exactly, is C so popular? Especially in comparison to C++. I can't think
>of a single reason to use C instead of C++ for most of the coding that I
>would do. I generally only write user applications. I don't get anywhere
>near the kernel which is where I'd imagine most of the reason for using
>C comes in. Yet I see people writing 'modern' GUI applications and using
>C when I would think C++ would be a much better choice. Is there
>something that I'm missing? Something that C actually does better than
>C++ in regards to higher-level functions?
>

>(Note that I tend to gravitate towards higher level languages by nature.
>I use Perl religiously, and I love Java. If not for some of the speed
>limitations and, more importantly, the fact that it's non-free, I would
>say that Java is the perfect language. Hmm... is that gasoline I smell?
>:)
>
>
>
This has been one of the funniest threads I've read in months. Thanks :)

I don't have any theory, history or humor (unfortunatly) to add to this
discussion, so I'll just add my experiance and reasons.

I know C fairly well. I haven't written my own operating system or
anything but I can accomplish the tasks I set out to do with it. I know
C++ and have about the same level of skill. Why do I ever use C over C++
since I'm not writing kernels or drivers or anything?

Lots and lots of documentation, code examples and libraries are in C. I
wonder how less works. Hmm. C code. How about a gtk? C examples have
been around longer. What about the source code for that MUD I use to
play? C. dpkg? C. Hmm. Well how are chgrp, chmod, cp, mkdir, mkfifo,
rmdir, and touch coded? ____ (yes, C).

Ok, well I've been told how cool I'll be if I program OO, and I'm going
to be a purist for my little CLI program. I start hacking away and boom
first puzzle. Isn't there a class for getopt? I can read all about
getopt(3) in man, but Google isn't lighting my path for CGetOpt.cpp. So
I either roll my own class around getopt(3), put the C code into a non
class function (or just in main) or re-invent that wheel. (There's
probably a better solution out there, the point is I couldn't find it.)

The program grows, and I've got someone interested in helping me. OO ==
cOOl remember? Only they like to indent one way and I like to indent
another. No problem! That's what indent(1) is for? What's this garbage.
It hates my class definition and does wierd things to my object
formatting. Oh, it's for C. (I know, there are other programs for C++,
but the point is indent was installed with gcc, they weren't installed
with g++.) Well, we'll just use the same IDE like Anjuta. That will keep
us straight. Oh no, problems again. It still fights us on how we like to
indent our class definitions. I'm still lookig for CGetOpt.cpp and now
I'm also looking for CSignal.cpp, CSocket.cpp and CErrNo.cpp. I would
_hate_ to think that 'icky' globals are floating around just because I
wanted to get the error from some C call that didn't return a success value.

I do use C++ a lot when coding for windows using VisualStudio and as
much as I loath the MFC documentation for lacking in details, I am
comparing that lack to my C API documentation in man, not to C++ on
Linux. I suppose that isn't fair and if I were to purchase some C++
library for use on Linux it may be very well coded. I just expect it to
be 'free as in C'. I have only dabbled in GUI programming in Linux.
Maybe if I did more I would learn more is out there.

In summary on why I sometimes use C over C++ on Linux, it's because the
documentation, tools and examples are there for C. I'm fine with C++
classes using printf() and select(), but some people I collaborate with
aren't OK with it. I am very aware of the STL documentation on sgi.com.
I use it _very_ frequently, but STL doesn't cover every aspect of
programming to enable me to avoid C calls. It's no (sorry) MFC. I think
if there was a C++ version of CPAN, a collection of 'free as in C' (I
liked that one) documentation and classes, it would really be helpfull
to me, and possibly others, for using C++ more. I thought the Dinkumware
site was annoying. It was more 'free as in Windows Media Player' or
'free as in Yahoo Groups'...

Now, onto other languages.

Perl! :)

I know it's weird, but it does make it easier to write poetry in perl. :-)

--Larry Wall in <78...@jpl-devvax.JPL.NASA.GOV>

man sed; let $there 'be'; perl -e 'and: $life = "great";'
Neil Archibald
- /dev/IT -

#!/usr/bin/perl

package I;
sub m {print "I'm $_[0]\n";}
sub AUTOLOAD {print "$AUTOLOAD $_[0]\n";}
1;
package He;
sub s {print "He's $_[0]\n";}
sub AUTOLOAD {print "$AUTOLOAD $_[0]\n";}
1;
package main;
sub AUTOLOAD {our $AUTOLOAD=~s/main:://;print "and $AUTOLOAD $_[0]\n";
+}
sub Wednesday {print "On Wednesdays ";}

I'm("a lumberjack") && I'm("OK");
I::sleep("all night") && I::work("all day");
I::chop("down trees"),I::eat("my lunch");
I::go("to the lavatory");
if (Wednesday()) {I::go("shopping") && have("buttered scones for tea")
+;}

He's("a lumberjack") && He's("OK");
He::sleeps("all night") && He::works("all day");
He::chops("down trees"),He::eats("his lunch");
He::goes("to the lavatory");
if (Wednesday()) {He::goes("shopping") && has("buttered scones for tea
+");}

...etc.

Cheers, Ben


Come on! If that's not fun, what is??? Oh, and I love this quote by L. Wall:
Perl is ugly because people wanted it that way.

Why do I use perl? Again because it's so prolific. There are tons of
examples, a few good books, and CPAN. I can't even begin to count the
number of times I've thought 'I wonder if someone's already coded this,'
and found it on CPAN.

Why don't I write in other languages even though others say it's vastly
better and are willing to start holy wars on the matter?

There are a few reasons.
I may not have tried them out long enough to form an opinion (python,
ruby, scheme/lisp).
I did try them (took classes even) and was glad when the experiance was
over (COBOL, pascal, BASIC).
I have used them but when I think of a problem they infrequently come to
mind as the solution (Java).

Maybe I suffer from the hammer syndrome; "When all you have is a hammer,
everything looks like a nail." I try to broaden my program language
horizons, but it can often be a frustration. Ever typed $i in C and
forgot to decorate your variable in Perl? My outlook (and collection of
languages) might be different if I had started programming today instead
of 16 years ago. I know I don't suffer from the 'sheep syndrome.' I
don't write in C because everyone else does, I write in C because
someone else left instructions on how to write in C, and being able to
get help and code something (C) for me is better than not finding the
answer and writing nothing (C++).

I am glad that for people who hate C, but love Pascal, there is Pascal
(and any other combination that fits you.) Some days I have thought of
how /usr has grown over the years by adding C++ (and oo libraries like
ACE) then Perl then Python then Ruby etc. and how that at times seems to
be a 'waste of space' (mutter, if only they'd all use C and Perl I
wouldn't have to download all these packages...) :P, but thinking of the
choices it gives everyone and the extra software that might get written
because some group's 'cup of tea' language is there it doesn't seem like
a waste at all.

Jacob

Jacob Anawalt

unread,
Aug 28, 2003, 2:10:09 AM8/28/03
to
Ron Johnson wrote:

Quick question Steve.
Was this code on a Unix system, or did you have one nearby? Did you know
about the indent program at the time? (man indent)

It _seems_ to work for me to convert someone elses sytle (or lack of it)
in coding C into a format that I like (K&R).

Jacob

Jacob Anawalt

unread,
Aug 28, 2003, 2:30:11 AM8/28/03
to
bob parker wrote:

> C is easier to learn than shell scripting, the elements at least, much
> less
>
>Perl. I personally find it quicker to code a dirty fix in C than anything
>else and would not really consider shell programming for anything other than
>glue for a sequence of other commands.
>
>Just my 2 bits.
>
>
>
>

Another great example on why the variety is a good thing. I agree on the
C vs shell. The only way I write shell scripts is by example. I don't
understand it well enough to write a script from a blank page. On the
otherhand, I _so_ find myself wishing I could use regexp's this way in
C/C++:

$email_in = 'Anawalt, Jacob; <jacob@cachevalley,com>; runme&';
$vc = 'a-zA-Z0-9'; #Valid username and domain characters
$vd = '.-'; #Valid domain non-characters
$vu = $vd . '_'; #Valid username non-characters (domain plus an underscore)

$email_out = $email_in;
$email_out =~ s/,/./g;

# Look for just the username@domain portion of the email
if($email_out =~ /([$vc][$vc$vu]*)\@([$vc$vd]*[$vc])?/) {
#Match worked, email is just username@domain portion
$email_out = "$1\@$2"; #$1 and $2 are the patterns \1 and \2 matched
from the regexp
} else {
#Match failied, empty string;
$email_out = '';
}

print "$email_out\n"; #Prints ja...@cachevalley.com.

If somone else is happier writing a cool class and some loops or
figuring out a C++ regexp class to do this, or just some adept use of C
string library calls, more power to you. :)

Jacob

Alex Malinovich

unread,
Aug 28, 2003, 2:40:09 AM8/28/03
to
On Wed, 2003-08-27 at 14:45, Pigeon wrote:
--snip--
> The tide really turned in Russia after an exploit against Microsoft
> Powerpoint caused Vladimir Putin's presentation to the United Nations
> to inform the assembled delegates that their mother was a hamster and
> their father smelt of elderberries. A purge on all Microsoft products
> followed and several million Windoze CDs were ceremonially burned in
> front of the Kremlin. Bill Gates despatched himself to Russia to try
> and restore Microsoft's fortunes; his limousine stalled on a level
> crossing; the driver escaped, but the rear doors apparently jammed and
> Gates was crushed by a train. Within months every computer in Russia
> was running Linux, computer dysfunctionality dropped to minimal levels
> and the effect on Russia's economy was such that the West was forced
> to follow their example. The change was slow initially, but once
> enough Western organisations had installed Linux that its success was
> shown to be no peculiarity of Russia, market forces did the rest, and
> Microsoft disintegrated.
>
> Oops, sorry, we haven't got that far yet...

You silly English K-nigit! Getting my hopes all up hoping that Gates was
dead! How rude! :)
--
Alex Malinovich
Support Free Software, delete your Windows partition TODAY!
Encrypted mail preferred. You can get my public key from any of the
pgp.net keyservers. Key ID: A6D24837

signature.asc

Alex Malinovich

unread,
Aug 28, 2003, 2:50:08 AM8/28/03
to
On Wed, 2003-08-27 at 21:43, Ron Johnson wrote:
> On Wed, 2003-08-27 at 16:01, Alex Malinovich wrote:
> > Дана сре, 27-08-2003 у 13:06, Steve Lamb је написао:
> > > On Wed, 27 Aug 2003 04:21:05 -0700
> > > Paul Johnson <ba...@ursine.ca> wrote:
> [snip]
> > with C. I'm also very reluctant to learn Python because I'm very adamant
> > in how I use whitespace. Though I will need to pick it up sooner later.
>
> <innocently> Why Alex, whatever do you mean by that?

And speaking of whitespace, all this comments "start in column 7 and
code starts in column 8, not to exceed column 72" is driving me bonkers!
:) Though, being that you were the first one to bring this up, and as
much as I hate to admit it, I'm beginning to enjoy COBOL. I actually
wrote a decent size declaration section today for the first time and I
am extremely impressed.

I've been using Perl for a number of years with programs that store data
in flat files. Usually using a combination of likely-to-be-unique record
delimiters (usually :&:) and repeated calls to split(). To find a
language that automatically does it for you before you ever even get to
the 'real' code is really fascinating. As is the whole 88 thing. I
believe they're referred to as conditionals.

And that reminds me, you were the one that suggested KOBOL right? I saw
that they have a demo version of it available. Is it crippled in any
way? They have NO information available on the demo version on the site.
(Other than where to download it of course.)

signature.asc

Alex Malinovich

unread,
Aug 28, 2003, 3:00:13 AM8/28/03
to
On Thu, 2003-08-28 at 01:13, Jacob Anawalt wrote:
> bob parker wrote:
>
> > C is easier to learn than shell scripting, the elements at least, much
> > less
> >
> >Perl. I personally find it quicker to code a dirty fix in C than anything
> >else and would not really consider shell programming for anything other than
> >glue for a sequence of other commands.
> >
> >Just my 2 bits.
> >
> >
> >
> >
> Another great example on why the variety is a good thing. I agree on the
> C vs shell. The only way I write shell scripts is by example. I don't
> understand it well enough to write a script from a blank page. On the
> otherhand, I _so_ find myself wishing I could use regexp's this way in
> C/C++:

You know, I think I've written 2 shell scripts in my life. And I think
the most complex of the two was 6 lines long and used a for loop. On the
other hand, I generally write 2 Perl scripts daily that could quite
possibly be done as shell scripts. But I'm so addicted to the string
handling functions that I can't help it. I've actually found myself
cursing C++ and Java when I catch myself starting to type
myStringVariable =~ s/ /_/; or some such only to realize that it won't
work. :)

signature.asc

Steve Lamb

unread,
Aug 28, 2003, 3:10:09 AM8/28/03
to
On Wed, 27 Aug 2003 23:52:35 -0600
Jacob Anawalt <ja...@cachevalley.com> wrote:
> Was this code on a Unix system, or did you have one nearby? Did you know
> about the indent program at the time? (man indent)

> It _seems_ to work for me to convert someone elses sytle (or lack of it)
> in coding C into a format that I like (K&R).

That's just it, I don't like C indenting any more, period. It isn't
"someone else's style" that is the problem, it is the fact that it is the
antithesis of how I've grown to like to code. Lemme put it this way:

C:
if foo
bar;

Python:
if foo:
bar

Want to extend it?

Python:
if foo:
bar
baz

C:
if foo
bar;
baz;

Bzttttt, wrong....

if foo {
bar;
baz;
}

But wait, baz really shouldn't be a part of the if statement!

Python:
if foo:
bar
baz

C:
if foo
bar;
baz;

No, darn it, only if foo is false, really.

Python:
if foo:
bar
else:
baz

C:
if foo
bar;
else
baz

Nope...

if foo {
bar;
}
else {
baz;
}

It boils down to this. In Python if I want something to be in a block, I
smack tab and don't even need to worry about my editor doing the right thing.
I tell it to set tab stops to 4, save all spaces and how the code is written
is how it will run. If I need to pull that call out of a block I just delete
space to line up to the previous block. << or >> or V<, V> or several other
commands in vim work nicely for this. If I need to add to a block I just tab
over to the right spot and there it is.

The main problem with "other people's style" isn't so much a matter of
indenting blocks (any half-assed decent programmer does that to some degree)
it is a matter of block delimiter placement. Some people prefer to have the
block delimiters separate of the line that starts the block. Some prefer the
opening on the same line so the closing lines up with the keyword opening the
block. Some consider else its own block and having it line up with the if
makes sense. Others consider it a continuation so they slap it onto the end
of the if block. What have I described?

a:
if cond
{
block
}
else
{
block
}

b:
if cond {
block
}
else {
block
}

c:
if cond {
block
} else {
block
}

3 different styles. But remove the damnedable braces and what are you
left with?

if cond
block
else
block

Hence it is not other people's style I dislike, it is the freakin' braces.

Steve Lamb

unread,
Aug 28, 2003, 3:10:16 AM8/28/03
to
On Thu, 28 Aug 2003 01:51:23 -0500
Alex Malinovich <demo...@the-love-shack.net> wrote:
> You know, I think I've written 2 shell scripts in my life. And I think
> the most complex of the two was 6 lines long and used a for loop. On the
> other hand, I generally write 2 Perl scripts daily that could quite
> possibly be done as shell scripts. But I'm so addicted to the string
> handling functions that I can't help it. I've actually found myself
> cursing C++ and Java when I catch myself starting to type
> myStringVariable =~ s/ /_/; or some such only to realize that it won't
> work. :)

I'm with you there. At my past two jobs I had to work on several shell
scripts. Step 1 was to take the shell script and rewrite it in Perl. No
matter how complex the shell script was it didn't take me long to rewrite it
in Perl. Step 2 was then to make the modifications requested. I found that
if I just rewrote to Perl I'd get the job done in a fraction of the time it
would otherwise take me.

Of course now step 1 has been replaced with "rewrite in Python". I still
have Perl coursing through my veins though. The other day I caught myself
trying to upper(s) a string instead of string.upper(). The deciding day that
I committed myself to Python was the day when I was able to take a Perl script
and convert it to a multi-threaded Python script that was not only under a
page long but was also readable to my coworker who didn't know either Perl or
Python. All I gotta say is that os.path.walk() is a godsend. :)

Alex Malinovich

unread,
Aug 28, 2003, 3:20:08 AM8/28/03
to
On Wed, 2003-08-27 at 18:15, Yves Goergen wrote:
> right. i was wondering, not long ago, if there's a possibility to
> merge both parameters of the 'rename' shell script into one and port
> all this to, say, windows. there are many situations where such a tool
> would make my life a bit easier...

As much as I hate to admit that MS can do some things right, their 'ren'
command (rename, instead of doing a mv from name to name like we do) is
actually quite intelligent. Not quite to the point of regexps, but you
can do things like ren *.txt *.doc or whatnot and it will actually work.
And if there's already a shell-script for it (I'm not familiar with
'rename') just run it in Cygwin. :)

signature.asc

Alex Malinovich

unread,
Aug 28, 2003, 3:40:20 AM8/28/03
to
On Wed, 2003-08-27 at 22:49, bob parker wrote:
--snip--

> I once wondered why all illustrations of C++ programming showed two classes,
> foo and bar. The I discovered that 'fubarred' means 'fsked beyond repair'.
> That is sufficient explanation.

Actually, I believe it's meant to be 'fsckd up beyond all recognition'
and was originally 'fubar'. Though there has been discussion regarding
whether foobar and fubar have any real relation. For a rather complete
writeup on the topic, see:

http://dictionary.reference.com/search?q=foobar

and

http://dictionary.reference.com/search?q=foo

signature.asc

Alex Malinovich

unread,
Aug 28, 2003, 5:20:17 AM8/28/03
to
On Thu, 2003-08-28 at 01:55, Steve Lamb wrote:
--snip--

> Hence it is not other people's style I dislike, it is the freakin' braces.
startHolyWar(emacs-vs-vi);
return 0;

startHolyWar(typeOfWar) {
do {
print "Insert new response: ";
$response = <STDIN>;
} until ($response =~ /[Hh]itler|[Nn]azis?/);
}

That's only because you're not using the One True Editor! :) If you're
using emacs with a good mode for the language a lot of that is taken
care of for you. I've never seen anything that comes anywhere even close
to cperl though. I type:

if

I get

if (<cursor placed here) {
<later cursor position>
}

After filling in the condition, I hit enter and my cursor gets moved to
the "later" position. That way, there's nothing to hate about brackets.
:)

And I must say that of what I've seen of Python, I get very easily
confused. Trying to keep track of levels of loops and if's based on
indentation just doesn't cut it for me. I deal much better with counting
brackets or, better yet, having The One True Editor highlight
corresponding brackets as I pass over their partners. :)

signature.asc

Peter Hugosson-Miller

unread,
Aug 28, 2003, 5:40:16 AM8/28/03
to
Jacob Anawalt wrote:

<!-- Snip -->

> ...and how that at times seems to be a 'waste of space' (mutter, if

> only they'd all use C and Perl I wouldn't have to download all these
> packages...) :P, but thinking of the choices it gives everyone and the
> extra software that might get written because some group's 'cup of
> tea' language is there it doesn't seem like a waste at all.

Amen brother!

--
Cheers,

.~.
/V\
// \\
/( )\
^`~彭
< hugge >
"I'll give up Smalltalk when they pry the browser from my cold, dead
fingers!"

Steve Lamb

unread,
Aug 28, 2003, 5:50:10 AM8/28/03
to
On Thu, 28 Aug 2003 04:18:13 -0500
Alex Malinovich <demo...@the-love-shack.net> wrote:
> On Thu, 2003-08-28 at 01:55, Steve Lamb wrote:
> --snip--
> > Hence it is not other people's style I dislike, it is the freakin'
> > braces.
> startHolyWar(emacs-vs-vi);

That wiffing sound! Ah, the sound of a point sailing over someone's head.

Having an editor that tries to do the right thing (which more often than
not gets in the way) does not, in any way, make me more capable of reading the
code.

"Ah-HA! But THAT's what Indent is for!"

Yeah, on supported languages. I don't see the point of having a tool to
shoehorn the code into one bracket style and another tool to shoehorn it into
a different bracket style (and hope it remains decent) when one could just get
rid of the bloody brackets and be done with it. Hence my last stanza of
pseudo code showing all of the different styles being all the same code
without the brackets.

Colin Watson

unread,
Aug 28, 2003, 6:00:17 AM8/28/03
to
On Thu, Aug 28, 2003 at 01:49:22PM +1000, bob parker wrote:
> On Thu, 28 Aug 2003 00:17, Dave Howorth wrote:
> > PS I'm a Luddite that refuses to learn C++. Backward compatibility with
> > C was the single biggest mistake Stroustrup made.
>
> I once wondered why all illustrations of C++ programming showed two classes,
> foo and bar. The I discovered that 'fubarred' means 'fsked beyond repair'.
> That is sufficient explanation.

Those bits of slang are far from specific to C++.

--
Colin Watson [cjwa...@flatline.org.uk]

Colin Watson

unread,
Aug 28, 2003, 6:10:08 AM8/28/03
to
On Thu, Aug 28, 2003 at 01:44:50AM -0500, Alex Malinovich wrote:
> I've been using Perl for a number of years with programs that store
> data in flat files. Usually using a combination of likely-to-be-unique
> record delimiters (usually :&:) and repeated calls to split(). To find
> a language that automatically does it for you before you ever even get
> to the 'real' code is really fascinating.

Hey, Perl has autosplit mode; see perlrun(1) ...

Alex Malinovich

unread,
Aug 28, 2003, 6:10:11 AM8/28/03
to
On Thu, 2003-08-28 at 04:41, Steve Lamb wrote:
--snip--

> Yeah, on supported languages. I don't see the point of having a tool to
> shoehorn the code into one bracket style and another tool to shoehorn it into
> a different bracket style (and hope it remains decent) when one could just get
> rid of the bloody brackets and be done with it. Hence my last stanza of
> pseudo code showing all of the different styles being all the same code
> without the brackets.

But see my last paragraph in my previous post. Those brackets which make
things so hard for you to read are the same brackets that make it easy
for me to read. I look at Python code and I get lost. I guess my eyes
are out of alignment or something, because I can't just look at
indentation and see what corresponds to what. (Especially so with 4
nested ifs, loops, etc) With bracketed languages, however, I can just
keep a count of brackets in my head and always know where I am.

Though I'm afraid that I do at least have to agree on the multiple ways
of bracing. I much prefer method C in your descriptions, and method A I
can deal with, but B drives me up a wall! Now if someone would devise a
language with an extremely solid OO structure, good garbage collection,
easy interfaces to C libraries, and most importantly, forced type C
bracketing, I'd be in heaven! :)

signature.asc

Ron Johnson

unread,
Aug 28, 2003, 6:20:19 AM8/28/03
to
On Thu, 2003-08-28 at 02:04, Steve Lamb wrote:
> On Thu, 28 Aug 2003 01:51:23 -0500
> Alex Malinovich <demo...@the-love-shack.net> wrote:
[snip]

> Of course now step 1 has been replaced with "rewrite in Python". I still
> have Perl coursing through my veins though. The other day I caught myself
> trying to upper(s) a string instead of string.upper(). The deciding day that

There's an even quicker way, that's even OO:
>>> import string
>>> s = 'foo'
>>> s.upper()
'FOO'

> Python. All I gotta say is that os.path.walk() is a godsend. :)

As are, IMO,
.isabs()
.isfile()
.isdir()
.islink()
.ismount()
.realpath()

--
-----------------------------------------------------------------
Ron Johnson, Jr. ron.l....@cox.net
Jefferson, LA USA

Thanks to the good people in Microsoft, a great deal of the data
that flows is dependent on one company. That is not a healthy
ecosystem. The issue is that creativity gets filtered through
the business plan of one company.
Mitchell Baker, "Chief Lizard Wrangler" at Mozilla

Steve Lamb

unread,
Aug 28, 2003, 6:30:20 AM8/28/03
to
On Thu, 28 Aug 2003 05:09:03 -0500
Ron Johnson <ron.l....@cox.net> wrote:
> On Thu, 2003-08-28 at 02:04, Steve Lamb wrote:
> > On Thu, 28 Aug 2003 01:51:23 -0500
> > Alex Malinovich <demo...@the-love-shack.net> wrote:
> [snip]
> > Of course now step 1 has been replaced with "rewrite in Python". I
> > still
> > have Perl coursing through my veins though. The other day I caught myself
> > trying to upper(s) a string instead of string.upper(). The deciding day
> > that

> There's an even quicker way, that's even OO:
> >>> import string
> >>> s = 'foo'
> >>> s.upper()
> 'FOO'

Well, actually, as of 2.1 or so that isn't needed. All the methods from
string are already applicable to strings. Hence..

> > trying to upper(s) a string instead of string.upper(). The deciding day

^^^^^^^^^^^^^^^

:)

> > Python. All I gotta say is that os.path.walk() is a godsend. :)

> As are, IMO,
> .isabs()
> .isfile()
> .isdir()
> .islink()
> .ismount()
> .realpath()

.basepath() is fun too. Fun with symlinks! :)

name = os.path.basename(sys.argv[0])
if (name == 'spam' or name == 'ham'):
sa_learn = '/usr/bin/sudo -u mail /usr/bin/sa-learn --%s --file *' %
(name)

Alex Malinovich

unread,
Aug 28, 2003, 6:40:11 AM8/28/03
to
On Thu, 2003-08-28 at 04:32, Colin Watson wrote:
> On Thu, Aug 28, 2003 at 01:44:50AM -0500, Alex Malinovich wrote:
> > I've been using Perl for a number of years with programs that store
> > data in flat files. Usually using a combination of likely-to-be-unique
> > record delimiters (usually :&:) and repeated calls to split(). To find
> > a language that automatically does it for you before you ever even get
> > to the 'real' code is really fascinating.
>
> Hey, Perl has autosplit mode; see perlrun(1) ...

Aah! I did not know that! Thanks! :) So I can at least slightly clean up
my code now. Though come to think of it, that could really be useful for
parsing long (i.e. --option=value) command line arguments as well. I
really should have studied that man page better. But I always kind of
figured that anything interesting you were going to do with Perl would
be done in the code itself. :)

signature.asc
It is loading more messages.
0 new messages