Announcement

Collapse
No announcement yet.

Data statement comments & size of exe

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Data statement comments & size of exe

    The items coming after a data statement, whether numbers
    or quoted strings, are always treated as strings.

    So if you want to comment a data statement you must
    preceed the comment by a colon like this

    data 1,2,3,4 :'this is some data

    If you are concerned about the size of your executable,
    you should slam the colon right up against the last
    datum -- because whatever is between the last datum and
    the colon adds a corresponding number of bytes to the
    executable. A tab adds one byte, a space adds one byte.

    This is true even though the last datum will be read
    as you would expect -- without the tabs or spaces.

    You can try this out on a trivial example

    read a$
    print a$;"x"
    data 1,2,3,4 :'xxxx
    Politically incorrect signatures about immigration patriots are forbidden. Googling “immigration patriots” is forbidden. Thinking about Googling ... well, don’t even think about it.

  • #2
    Just out of curosity, what flavor of basic are you using. In
    mine (pb 2.1f), commented statements are not included in the
    executable and therefore do not affect the .EXE size.
    Numbers are read as numbers and strings as strings. For example,

    read a,b,c$
    print;a,b,c$
    data 1,2,"This is a quoted string"

    will compile and run just fine. Or maybe it's just I am missing
    something.


    ------------------
    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.

    Comment


    • #3
      PB 3.5

      It's not a question of compilation -- it compiles perfectly.
      But if you're concerned about the size of your executable,
      put the colon smack against the last data item. The
      compiler won't do it for you.


      [This message has been edited by Mark Hunter (edited March 10, 2001).]
      Politically incorrect signatures about immigration patriots are forbidden. Googling “immigration patriots” is forbidden. Thinking about Googling ... well, don’t even think about it.

      Comment


      • #4
        Please excuse me my dyslexia. I had to re-read the original
        post half a dozen times before it filtered in to what you were
        saying. I wrote a small test program and added TAB's, one at a
        time. The .EXE originally compiled to 27,512 bytes and then,
        after just one more tab, jumped in size to 27,528 bytes (a
        16-byte increase). I think this is based on memory structure.
        I seem to recall that segments are separated by 16-byte blocks
        or something like that. Anyway, that's a good thing to keep in
        mind for future reference.


        ------------------
        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.

        Comment

        Working...
        X