1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

@LINES, long lines, TCC disappears

Discussion in 'Support' started by vefatica, Oct 6, 2011.

  1. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,941
    Likes Received:
    30
    I tried @LINES on a big (1MB) file containing no newlines. TCC disappeared.
     
  2. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,855
    Likes Received:
    83
    disappeared.

    Not particularly surprising. Why would you do such a thing?
     
  3. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,941
    Likes Received:
    30
    I didn't choose that file specifically. It was simply included in a DO set.

    I am of the opinion that an app should never crash as a result of what the user does (short of deliberate sabotage). An error message, or warning, or simply "1" (for a non-empty file containing no newlines) would have been fine.
     
  4. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,855
    Likes Received:
    83
    It's a nice theory. In the real world, the amount of error trapping the
    programmer can do is finite, while the number of bizarre things a user can
    do is infinite.
     
  5. CaesarR

    Joined:
    Nov 3, 2010
    Messages:
    9
    Likes Received:
    0
    On Thu, 06 Oct 2011 18:09:38 -0400, rconn <>
    wrote Re RE: [Support-t-3267] Re: @LINES, long lines, TCC disappears:


    Well put.
     
  6. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,941
    Likes Received:
    30
    Cute quip.

    The file contained 1,048,576 bytes (of text) and no newlines. Had that file contained 1,048,575 or 1,048,577 bytes, TCC would not have crashed and would have correctly returned 0.

    That also goes for any file with no newlines whose size is exactly a power of two greater than 65536 ... crash ... one more or one fewer character ... no crash.

    That certainly is peculiar.
     
  7. nikbackm

    Joined:
    May 30, 2008
    Messages:
    194
    Likes Received:
    1
    Sounds to me as if it crashes if the file size is an exact multiple of the buffer size used for reading the file contents.
     
  8. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,941
    Likes Received:
    30
    On Fri, 07 Oct 2011 07:14:55 -0400, nikbackm <> wrote:

    |Sounds to me as if it crashes if the file size is an exact multiple of the buffer size used for reading the file contents.

    I suspected that too but it was easier to check powers of 2.

    I just tried 3*2^16 ... crash.

    TCC 13.00.24
    Module=D:\tc13\TakeCmd.dll
    Address=10029C11
    Exception=C0000005
    EAX=03260000 EBX=016BFC94 ECX=0165CA61 EDX=77AE70B4
    ESI=03230000 EDI=03230000 EBP=016BFC08 ESP=0165CAB0
    CS=0000001B DS=00000023 ES=00000023 SS=00000023
    Flags=00010216

    Stack:
    1 : TakeCmd.dll 00000001:00028c11
     

Share This Page