Thread: Does this make any sense?

  1. #16
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    For this line: (assuming you make the above fix...)
    Code:
    strcat(lineh,line);//append line to accomodate lineh
    You are copying a string (char array) into a char. Bad idea. Fix it.
    Mainframe assembler programmer by trade. C coder when I can.

  2. #17
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    For this warning:
    Code:
     
    lineh = linea;
    You are trying to assign a pointer to an int array to a 1 byte char. Bad idea. Fix it.
    Mainframe assembler programmer by trade. C coder when I can.

  3. #18
    That weird Java guy xniinja's Avatar
    Join Date
    Jun 2010
    Posts
    231
    I have some ideas but i want to be perfectly clear that there is a way to fix this without rewriting the entire code.

  4. #19
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    I have some ideas but i want to be perfectly clear that there is a way to fix this without rewriting the entire code.
    Is that a question? There's a lot of little mistakes, so although you probably don't have to start from scratch, I would definitely go through line by line, and confirm that every line actually does what you think it does when you execute it.

  5. #20
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Yeah, read this A development process

    Then rewrite the code in much smaller steps, compiling and testing as you go.
    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.

  6. #21
    That weird Java guy xniinja's Avatar
    Join Date
    Jun 2010
    Posts
    231
    Thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. make with debug options
    By Andaluz in forum Linux Programming
    Replies: 4
    Last Post: 01-19-2010, 10:24 AM
  2. Does this even remotely make sense
    By hckr83 in forum C Programming
    Replies: 6
    Last Post: 12-23-2005, 05:02 PM
  3. Question about atheists
    By gcn_zelda in forum A Brief History of Cprogramming.com
    Replies: 160
    Last Post: 08-11-2003, 11:50 AM
  4. 'functions' in make?
    By mart_man00 in forum C Programming
    Replies: 1
    Last Post: 06-21-2003, 02:16 PM
  5. Foreigners don't make sense
    By Shadow in forum A Brief History of Cprogramming.com
    Replies: 19
    Last Post: 04-25-2002, 02:31 PM