No announcement yet.

A stupid question

  • Filter
  • Time
  • Show
Clear All
new posts

  • A stupid question

    I've seen in postings on this BBS, and I think in my online
    PB/DLL 6.0 help, that it's better to use LONG's than INTEGER's
    where possible, because it makes for greater CPU efficiency.

    My question is: does this also apply to programs written using
    PB/DOS? It seems like it would, because, whether it's a 32-bit
    program or a DOS program, they both use the same CPU. However,
    I need to make sure, so I can decide on whether or not to recode
    my custom PBU's (and for future DOS programming). The main reason
    that I'm not sure is that my QPP (version 1.30) uses almost
    nothing but INTEGER's in its procedures. So, maybe the DOS
    anatomy is better off using INTEGER's, as compared to LONG's?

    Thanks in advance!

    Clay C. Clear

    mailto:[email protected][email protected]</A>

    Clay Clear's Software

  • #2
    If you are doing some serious number crunching, use integers
    whereever possible instead of longs. Somebody correct me if I'm
    wrong but integers use two bytes of memory whereas longs uses
    4 bytes. Integers are about 2 to 6 times faster in processing
    speed than longs (and quads, etc).

    P.S. I spent 20+ years in the Air Force and I have learned that
    the only "stupid" questions are those that goes un-asked.


    [This message has been edited by Mel Bishop (edited September 06, 2001).]
    There are no atheists in a fox hole or the morning of a math test.
    If my flag offends you, I'll help you pack.


    • #3
      In 16-bit land (ie, PB/DOS or Win16 via PB/DLL 1.x-2.x) integers are the fastest.

      In 32-bit land (Win32 via PB/DLL or PB/CC) LONG-integers are the fastest.

      Basically, it comes down to using the variable size that is native to the mode the CPU is operating in.

      PowerBASIC Support
      mailto:[email protected][email protected]</A>
      mailto:[email protected]


      • #4
        Lance, Mel,

        Thanks for your replies!

        Lance, I think your reply was more informative than you
        realize - until I read it, I wasn't aware that CPU's even HAVE
        different "modes" between 16-bit and 32-bit. "Be proud of your
        ignorance! Flaunt it!", I always say. <laugh> OK, thanks again -
        that datum will come in handy when I finally get around to
        learning how to use the inline assembler in PB/DOS & PB/DLL.
        And, yes, I've already read the postings by yourself and Tom that
        emphatically state " NOT use DOS interrupt calls in
        Windows programs (or, "when Windows is running"?)...",
        that's a pitfall I already know to avoid.

        Anyway, thanks to you and Mel, I now know that I don't have to
        rewrite my PBU's (my interpretation of the QPP procedures was
        correct )


        Clay C. Clear

        mailto:[email protected][email protected]</A>

        Clay Clear's Software


        • #5

          Small world! I was in the US Air Force for 8-1/2 years! I had
          every intention of being a "Lifer", but I ended up being
          retired for medical reasons, and now subsist on Disability
          (nobody was willing to hire me after I became disabled <sigh> ), so
          I spend MANY hours on the computer and the 'Net, mainly programming.


          I apologize for this "off-topic" posting - I won't post anymore
          like it. just wanted to "touch base" with Mel. Sorry.


          Clay C. Clear

          mailto:[email protected][email protected]</A>

          Clay Clear's Software