Thread: The following is the PaintBrush Package...

  1. #1
    Registered User
    Join Date
    Jan 2004
    Posts
    20

    The following is the PaintBrush Package...

    Hi Guys...

    Now I am posting my Paintbrush Package as a ZIP File... Hope this is helpful for many...

    I also Hope that people of this board will cooperate by making suitable improvements to the code and further debugging it...

    Hoping 4 an extended Co-operation...

    Thanxxx..

    Arvind
    Just b Crazy abt Life and Programming.....

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    I would make the following comments

    1. Code in .h files
    Do not put code inside header files, unless that code is marked inline.

    2. inline functions
    There is no point in having inline functions which are over 100 lines long. Either the compiler will ignore you, or you're in for a lot of bloated code. inline functions calling other inline functions just makes it worse IMO.
    Reserve inline for
    small functions - ie less than 10 lines
    leaf functions - they don't call anything else
    frequently called functions - we're talking many 1000's of times per second here
    AFTER you have determined that there is a real benefit to the run-time performance of the code.
    Don't blindly make everything inline just for fun, because it is not a universal 'win'

    3. indentation
    Basically, your indentation sucks. Much of it is not indented at all, and the rest has no consistency at all. Matters are made even worse by mixing spaces and tabs to indent code, which is a sure-fire way of making it look horrible when loaded into an editor with different tab-stops to your editor. Use only spaces, then it will at least always look the same no matter how people choose to view it.

    4. global variables
    union REGS i,o;
    There is simply no reason for these to be global, and for sure they would need much better names if they were global.
    Long ago, I worked on a project where someone had managed to create a global variable called 'i'. Now that caused all sorts of fun, and you can't exactly search for a single letter in 100K+ source code lines.

    5. magic numbers
    bar3d(x1+40,y1,x1+80,y2+10,1,10);
    40, 80, 10 litter the code all over the place
    How about a descriptive #define for each one of these?

    6. Where is the C++?
    Apart from a few for(int y and other quick tricks useful in C++, where are all the classes?
    Why aren't things like line, circle, rectangle handled as classes, with say a base class called shape, and really neat things like virtual functions to draw things for you. That would eliminate nearly all of those case statements which you use in abundance.

    7. void main()
    Nuff said

    8. comments
    There seems to be a lot of commenting your use of the language ("returns values through arguments passed by reference.") and what is immediately apparent from simply looking at the code ("//Used for mouse:"), but there is very little to indicate what the overall plan is
    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.

  3. #3
    Its not rocket science vasanth's Avatar
    Join Date
    Jan 2002
    Posts
    1,683
    compiling your code seems to be hectic.. I used Turbo C as it was created in that.....


    and there is a missing header file and lots of warning. why dont you also give us the EXE so its easier for us to see the end product...

    You coding style definitely needs improvement.. Its like how i used to code before using Turbo C..

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to get RSSI value, send to sensor, sensor receive package, repackage it?
    By techissue2008 in forum Networking/Device Communication
    Replies: 1
    Last Post: 03-04-2009, 10:13 AM
  2. MSXML package
    By George2 in forum C# Programming
    Replies: 0
    Last Post: 06-18-2008, 07:32 PM
  3. Cannot install lrzsz package, please help
    By ssharish2005 in forum Tech Board
    Replies: 2
    Last Post: 06-20-2007, 05:36 AM
  4. 'portable' package
    By janklojo in forum C++ Programming
    Replies: 2
    Last Post: 12-22-2006, 01:58 PM
  5. Possible Loss of data
    By silicon in forum C Programming
    Replies: 3
    Last Post: 03-24-2004, 12:25 PM