Thread: Code review please

  1. #1
    Registered User
    Join Date
    Feb 2011
    Posts
    144

    Code review please

    Hi, everyone.

    I have previously asked people to review my code, and based on feedback, I've gone through several attempts at improvement. May I ask people to look at it once again? I'm doing all the source files alphabetically. This is an open-source Wikipedia bot.

    TIA,

    Richard

    SourceForge.net Repository - [autobotwiki] Contents of /accessory_functions.h

    SourceForge.net Repository - [autobotwiki] Contents of /accessory_functions.c

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    You seriously need to grow some confidence.
    Really... if you don't trust your own coding skills, take time off from the project and take a proper course in C and or C++ programming...

    We've all told you repeatedly there are serious deficiencies in your coding skills and style... but I still see them in the code posted. If you aren't interested in learning you may want to consider not asking us to abuse you yet again.

  3. #3
    Registered User
    Join Date
    Feb 2011
    Posts
    144

    So what are the deficiencies?

    So what are the deficiencies? I thought I addressed them all.

    The casts are deliberate - to gain the ability to compile unmodified as C++.

    Richard

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    > to gain the ability to compile unmodified as C++.
    First you need to read this, to learn that C and C++ do not overlap, simply by throwing in a load of casts.
    Incompatibilities Between ISO C and ISO C++

    Good C doesn't need casts.
    Good C++ doesn't need casts.
    Each cast is potentially a lost opportunity for the compiler to tell you that you've made a mess of something.

    You should pick ONE language and stop trying to write polyglots

    The style didn't seem too bad to me, FWIW.

    Some general points.
    1. Remove all the comments along the line of "added to shut the compiler up".
    Add
    #include <assert.h>
    and put
    assert(0);
    in all the "impossible" places.
    In a debug build, this would at least halt in a predictable manner if the unexpected happened.

    2. 517 if ((strcmp (h->szloginname, "RichardcavellBot") == 0)
    518 && (strcmp (szloginpassword, "secret") == 0))
    No matter how good your check-in process is, sooner or later, your real password will end up being committed.

    As for documentation, consider using Doxygen
    It's a bit of effort to get set up, but you can build up as you go along (say whenever you touch a file).
    What you get is some nice clickable HTML pages that anyone coming to the project will be able to get up to speed that much quicker.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Code review
    By bennywhere in forum C Programming
    Replies: 16
    Last Post: 10-20-2009, 09:00 PM
  2. code review please :)
    By happyclown in forum C Programming
    Replies: 5
    Last Post: 02-23-2009, 11:59 PM
  3. review this code
    By KIBO in forum C Programming
    Replies: 12
    Last Post: 08-14-2007, 02:28 PM
  4. code review
    By hamsteroid in forum C Programming
    Replies: 6
    Last Post: 04-04-2007, 12:23 PM
  5. Code review please
    By Brighteyes in forum C Programming
    Replies: 9
    Last Post: 03-29-2003, 06:28 PM