Loading ...
Sorry, an error occurred while loading the content.

Re: bug in compiler

Expand Messages
  • Benoit Cerrina
    Vipin, in any case the second loop looks a lot better to me, you should compute the loop invariants outside especially if the compiler has no mean to optimize
    Message 1 of 4 , Apr 1, 2001
    • 0 Attachment
      Vipin,
      in any case the second loop looks a lot better to me, you should compute the
      loop invariants outside especially if the compiler has no mean to optimize
      it
      (it cannot know that (strlen(p) /iCharsPerLine is supposed to return the
      same
      value at each iteration and since you didn't post your code it might not
      even be the
      case).
      Benoit
      ----- Original Message -----
      From: "vipin aravind" <vipin.aravind@...>
      To: "VIM Mailing list" <vim-dev@...>
      Sent: Saturday, March 31, 2001 12:57 PM
      Subject: bug in compiler


      > hello all,
      > ouch Iam again and again taunted by compiler and system
      > bugs.
      > I was editting one of the files to add the printing stuff and
      > I put a for loop for(i = 0 ; i < (strlen(p) /iCharsPerLine) , i++) , leave
      > internationalization
      >
      > it was looping twice although it should do it thrice.
      >
      > I got stunned at the behaviour.
      > so I put something like this
      >
      > loop = strlen(p)/iCharsPerLine;
      > for(i = 0 ; i< loop ;i ++)
      > and it cycled thrice.
      > amazing !!!!
      > vipin
      >
    • Vince Negri
      vipin wrote ... eh.. but what was the value of loop ? -- Vince Negri (vnegri@aslnet.co.uk) Application Solutions Ltd. Tel:+44(0)1273-476608
      Message 2 of 4 , Apr 1, 2001
      • 0 Attachment
        vipin wrote

        > I got stunned at the behaviour.
        > so I put something like this
        >
        > loop = strlen(p)/iCharsPerLine;
        > for(i = 0 ; i< loop ;i ++)
        > and it cycled thrice.
        > amazing !!!!
        > vipin

        eh.. but what was the value of 'loop'?

        --
        Vince Negri (vnegri@...)
        Application Solutions Ltd. Tel:+44(0)1273-476608 Fax:+44(0)1273-478888

        Legal Disclaimer: Any views expressed by the sender of this message are
        not necessarily those of Application Solutions Ltd. Information in this
        e-mail may be confidential and is for the use of the intended recipient
        only, no mistake in transmission is intended to waive or compromise such
        privilege. Please advise the sender if you receive this e-mail by mistake.
      Your message has been successfully submitted and would be delivered to recipients shortly.