Thread: Characters in Average cpp File

  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    18

    Question Characters in Average cpp File

    Hey, not exactly a programming question, but it pertains to a program I'm doing...hopefully not the wrong place for this

    Does anyone know where I can find the average number of characters per line in c++ source code? Not sure if this is really possible to find out..considering the variety in coding styles and such...If not maybe an estimate?

    Thanks

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    With or without whitespace? I just looked at a few files I had open and it ranged from 14 to 23 (without spaces) and 20 to 25 with spaces. I used MS Word's word count so however that counts characters is where those numbers came from.

    I have no idea where you might find that information, although you could write a program that calculates it and then download an open source project or two and run your program on it.

  3. #3
    Registered User
    Join Date
    Jan 2007
    Posts
    18
    Quote Originally Posted by Daved
    I have no idea where you might find that information, although you could write a program that calculates it and then download an open source project or two and run your program on it.
    I was going for with whitespace, that's a good idea though, might try that thanks, mate.

  4. #4
    pwns nooblars
    Join Date
    Oct 2005
    Location
    Portland, Or
    Posts
    1,094
    Daved: That treating tabs as one character or as 4 spaces (or what ever number of spaces you choose)?

    Personally most of my non-comment lines take up less than 40 chars (that is if you count tabs as 4 spaces each).

  5. #5
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    >> That treating tabs as one character or as 4 spaces.
    I don't know. It's Word so it might not have even treated a tab as one character. We keep tabs as tabs, so if they were converted to spaces it would probably make a noticable difference in the averages.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A development process
    By Noir in forum C Programming
    Replies: 37
    Last Post: 07-10-2011, 10:39 PM
  2. Newbie homework help
    By fossage in forum C Programming
    Replies: 3
    Last Post: 04-30-2009, 04:27 PM
  3. File transfer- the file sometimes not full transferred
    By shu_fei86 in forum C# Programming
    Replies: 13
    Last Post: 03-13-2009, 12:44 PM
  4. opening empty file causes access violation
    By trevordunstan in forum C Programming
    Replies: 10
    Last Post: 10-21-2008, 11:19 PM
  5. help with text input
    By Alphawaves in forum C Programming
    Replies: 8
    Last Post: 04-08-2007, 04:54 PM