a style question

Joe Kreidler kreidler at motcid.UUCP
Thu Oct 4 00:10:24 AEST 1990


zougas at me.utoronto.ca ("Athanasios(Tom) Zougas") writes:

>You know what they say: "Computers are very good at doing things 
>over and over and over again":-)

>Shaving microseconds does not make better code. Better algorithms do.

Tom brings up a very important point that people are missing. Stop and
think for a second, "Why do I code in C instead of assembler?" I hope
your answer is because C code is more portable, easier to develop, and
easier to maintain. I do not know of anyone who uses C because it
produces code that runs faster than assembler.

As software systems keep getting larger and more complex, it is
important to develop code that is easy to understand and can be ported
to new applications. This comes at the cost of less efficeint code
(when compared to assembler). If several microseconds are more
important than portabability and maintainabliity, than use assembler.
Otherwise, don't make such a fuss about which type of comparision
generates faster code. Besides, a comparison that runs faster on one
machine may be slower on a different machine.

I am not saying that efficiency is not important for a C program. C
programs should be written to run as fast as they can but this is
accomplished through the design of efficient algorithms and data
structures, not the choice of operators.

------------------------------------------------------------
Joe Kreidler                     1501 W Shure Drive
Motorola Cellular                Arlington Heights, IL 60004
...!uunet!motcid!kreidler        708-632-4664
------------------------------------------------------------



More information about the Comp.lang.c mailing list