Re: obfuscated c programming contest

Discussion in 'C Programming' started by John Bode, Feb 28, 2011.

  1. John Bode

    John Bode Guest

    On Saturday, February 26, 2011 4:41:34 PM UTC-6, K4 Monk wrote:

    [snip]

    > Blah blah aside, I'm interested in knowing where this hidden knowledge
    > comes from so I could harness it as well. How do I learn C of such
    > dignified level which gives us the choice to program badly if we like.
    >


    Write a lot of code.

    A lot of the entries in the IOCCC (at least the ones I remember) seemed to be inspired by just playing around with what was possible. Stuff like taking advantage of the commutativity of array indexing (a == i[a]), or using the component selection operator on the return value of a function (foo().x).

    Studying some parts of the language standard (a PDF of draft n1256 can be found at http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf) may giveyou some insight as well, especially the sections on conversions and expressions.

    > What is the timeline of a good C programmer? How much time, daily
    > practice etc. will it take to become this good?


    You can write code eight hours a day for 20 years, and still learn new stuff.
     
    John Bode, Feb 28, 2011
    #1
    1. Advertising

  2. John Bode

    Walter Banks Guest

    John Bode wrote:

    > On Saturday, February 26, 2011 4:41:34 PM UTC-6, K4 Monk wrote:
    >
    > > What is the timeline of a good C programmer? How much time, daily
    > > practice etc. will it take to become this good?

    >
    > You can write code eight hours a day for 20 years, and still learn new stuff.


    Eight hours a day plus evenings and weekends for more than 40 years
    and I am surprised at what I learn almost daily.

    w..
     
    Walter Banks, Feb 28, 2011
    #2
    1. Advertising

  3. John Bode

    Dr Nick Guest

    John Bode <> writes:

    > A lot of the entries in the IOCCC (at least the ones I remember)
    > seemed to be inspired by just playing around with what was possible.
    > Stuff like taking advantage of the commutativity of array indexing
    > (a == i[a]), or using the component selection operator on the
    > return value of a function (foo().x).


    Is that last considered obfuscated? I've used it in live code!

    Would you consider the following better or worse?

    while((nm = Next_Iterated_Name()).patt) {

    To me it's perfectly idiomatic. (Almost) everything is an expression,
    so you can apply operators to it.
    --
    Online waterways route planner | http://canalplan.eu
    Plan trips, see photos, check facilities | http://canalplan.org.uk
     
    Dr Nick, Mar 1, 2011
    #3
  4. John Bode

    K4 Monk Guest

    On Feb 28, 11:55 pm, Walter Banks <> wrote:
    > John Bode wrote:
    > > On Saturday, February 26, 2011 4:41:34 PM UTC-6, K4 Monk wrote:

    >
    > > > What is the timeline of a good C programmer? How much time, daily
    > > > practice etc. will it take to become this good?

    >
    > > You can write code eight hours a day for 20 years, and still learn new stuff.

    >
    > Eight hours a day plus evenings and weekends for more than 40 years
    > and I am surprised  at what I learn almost daily.
    >
    > w..


    example? how much of it would you attribute to being casual at
    programming and not digging deep down?
     
    K4 Monk, Mar 1, 2011
    #4
  5. John Bode

    Walter Banks Guest

    K4 Monk wrote:

    > On Feb 28, 11:55 pm, Walter Banks <> wrote:
    > > John Bode wrote:
    > > > On Saturday, February 26, 2011 4:41:34 PM UTC-6, K4 Monk wrote:

    > >
    > > > > What is the timeline of a good C programmer? How much time, daily
    > > > > practice etc. will it take to become this good?

    > >
    > > > You can write code eight hours a day for 20 years, and still learn new stuff.

    > >
    > > Eight hours a day plus evenings and weekends for more than 40 years
    > > and I am surprised at what I learn almost daily.
    > >
    > > w..

    >
    > example? how much of it would you attribute to being casual at
    > programming and not digging deep down?


    I have made my living from programming. At one level you learn programming skills
    and the ability to think and express yourself in another language. This skill set comes
    from practice and critical review of the results. Programming like most authoring
    skills requires that you really enjoy the process. It occupies your whole life.

    At a later point the objectives change, the programming skills are in place and
    content becomes the objective. A lot of our work is ISA development and the
    thinking process is changing again to define computational platforms for the future.

    Regards,


    w..
    --
    Walter Banks
    Byte Craft Limited
    http://www.bytecraft.com
     
    Walter Banks, Mar 2, 2011
    #5
  6. John Bode wrote:

    >It's not a matter of being casual or not wanting to dig into the language, it's a matter of simple and straightforward code being less buggy and easier to maintain than subtle or tricky code.


    "Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it." --Brian Kernighan

    --
    Roberto Waltman

    [ Please reply to the group.
    Return address is invalid ]
     
    Roberto Waltman, Mar 3, 2011
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    694
  2. Replies:
    1
    Views:
    314
    Gerrit Holl
    Mar 20, 2005
  3. K4 Monk

    obfuscated c programming contest

    K4 Monk, Feb 26, 2011, in forum: C Programming
    Replies:
    17
    Views:
    660
    Seebs
    Mar 4, 2011
  4. Todd Nathan
    Replies:
    10
    Views:
    199
    Alexander Kellett
    Feb 25, 2005
  5. Replies:
    0
    Views:
    116
Loading...

Share This Page