Hi All,
Can any one tell me sources to refer to write elegant C coding/ best
practices in C coding.
Regards,
Krishna Chaitanya
krishna wrote:
> Hi All,
> Can any one tell me sources to refer to write elegant C coding/
> best practices in C coding.
Check the kernel sources under Documentation/CodingStyle
Cheers,
Con
What I mean is both elegant and _efficient_ best practices in C coding.
Con Kolivas wrote:
> krishna wrote:
>
>> Hi All,
>> Can any one tell me sources to refer to write elegant C coding/
>> best practices in C coding.
>
>
> Check the kernel sources under Documentation/CodingStyle
>
> Cheers,
> Con
>
>
On Wed, Jan 05, 2005 at 09:13:04AM +0530, krishna wrote:
>
> What I mean is both elegant and _efficient_ best practices in C coding.
practice.
> Con Kolivas wrote:
>
> >krishna wrote:
> >
> >>Hi All,
> >> Can any one tell me sources to refer to write elegant C coding/
> >>best practices in C coding.
> >
> >
> >Check the kernel sources under Documentation/CodingStyle
> >
> >Cheers,
> >Con
> >
> >
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
Tim Hockin
[email protected]
Soon anyone who's not on the World Wide Web will qualify for a government
subsidy for the home-pageless.
On Mer, 2005-01-05 at 03:43, krishna wrote:
> What I mean is both elegant and _efficient_ best practices in C coding.
Documentation/CodingStyle is well worth a read. Also for that matter
just reading a lot of good code helps you write good code as reading
helps you learn a language better.
Efficiency is a harder subject: Remember that efficient code still must
be easy to understand so often is about algorithms not language, and in
part about hardware.
On the hardware side - the book "Unix systems for modern architectures"
But as Tim righly said "practice"
Alan
I'd say better to study compile theory and a kind of compiler source code.
On Wed, 05 Jan 2005 12:14:19 +0530, krishna
<[email protected]> wrote:
> Thank you very much.
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
--
Coywolf Qi Hunt
Homepage http://sosdg.org/~coywolf/
On Wed, Jan 05, 2005 at 03:49:07PM +0800, Coywolf Qi Hunt wrote:
> I'd say better to study compile theory and a kind of compiler source code.
Yes, gcc source definitely makes a great cautionary tale about the need of
writing elegant code and dreadful results of not doing so.
krishna <[email protected]> said:
[...]
> What I mean is both elegant and _efficient_ best practices in C coding.
Look for "Writing Efficient Programs", by Jon Bentley (sadly out of print),
and his "Programming Pearls" (2nd edition).
Keep in mind that "efficient" is mostly a thing of overall organization and
careful design (and data structure definition), not detailed programming.
Microoptimizations are usually counter-productive, at least by making the
code unnecessarily hard to read; current compilers aim at generating code
from "normally written C" that is at least as good as that a competent
assembly programmer would write with care (and often writing "more
efficient source code" just confuses the compiler into giving worse
results). Better aim at understandable, easy to get right code. If you
_measure_ later that it is too slow/large/..., _then_ go back and see how
to make it better. So Documentation/CodingStyle is an excellent starting
point.
--
Dr. Horst H. von Brand User #22616 counter.li.org
Departamento de Informatica Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria +56 32 654239
Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513
On Wednesday 05 January 2005 09.14, Al Viro wrote:
> On Wed, Jan 05, 2005 at 03:49:07PM +0800, Coywolf Qi Hunt wrote:
> > I'd say better to study compile theory and a kind of compiler source
> > code.
>
> Yes, gcc source definitely makes a great cautionary tale about the need
> of writing elegant code and dreadful results of not doing so.
LOL
I specifically recommend the ARM backend. It was copied from some other
RISC target, then a ARM thumb (16bit instruction width) backend was split
from that, and finally the thumb and 32bit backends were merged again,
apparently without removing much of the duplicated code.
Fun.
-- vbi
--
featured link: http://fortytwo.ch/gpg/subkeys
Hi,
Thank you very much for refering me for "programming pearls".
Regards,
Krishna Chaitanya