Results 1 to 5 of 5

Thread: Do you know: data types

  1. #1
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,818
    Rep Power
    10

    Do you know: data types

    Supported data types by thinBasic programming language

    thinBasic natively supports many different data types. Despite other programming languages (especially interpreted) that support only one kind of data type or very few (1 or 2 numeric and one string) thinBasic offers native support for the following data types:

    • numeric integer
      • BYTE (1 single byte - 8bits)
      • INTEGER (2 bytes - 16bits signed)
      • WORD (2 bytes - 16bits unsigned)
      • LONG (4 bytes - 32bits unsigned)
      • DWORD (4 bytes - 32bits unsigned)
      • QUAD (8 bytes - 64bits signed)

    • numeric flating point
      • SINGLE (4 bytes - 32bits - 6 precision digits)
      • DOUBLE (8 bytes - 64bits - 16 precision digits)
      • EXTENDED (10 bytes - 80bits - 18 precision digits)
      • CURRENCY (8 bytes - 64bits - 4 precision digits)

    • Strings
      • fixed string: STRING * n
      • fixed asciiz string: ASCIIZ * n
      • dynamic strings: STRING (up to 2Gb dynamically allocated)

    • UDT: user defined types (or structures)
      • TYPE/END TYPE
      • any complexity, any nested level (UDT inside UDT)
      • any numeric, string, other UDT or UNION data type (expect dynamic strings) can be used as UDT element

    • UNIONS
      • defined exactly as UDT but all elements are sharing the same memory area up to the longest element present in the UNION
    • VARIANT
      • Variant is a special data type that can contains most of the above data value.
        Usually Variants variables are used to deal with COM objects but in thinBasic they can be used as standard variables.
        There are special functions that can be used to determine what kind of data is stored into a specific Variant.


    Of course arrays (up to 3 dimensions) can be created for all the above data types.

    This can be a complication at first sight but in reality is not:
    • if you just need to deal with numers (whatever they are), just use Extended and will go perfect
    • if you just need to deal with strings (whatever they are), just use dynamic strings and all will be perfect

    thinBasic will make all the conversions for you when using language keywords.

    But if you need more complexity, for example calling external functions (inside external DLLs) or dealing with windows API, than you have all the types you need.
    And what when you will work with more typed languages like C or C++ or Java? You will be already familiar with all those types and no big problems.
    Last edited by ErosOlmi; 28-04-2011 at 21:17.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  2. #2
    thanks for your kindness now i am enable i can explain it thanks for your sharing it with us

  3. #3
    Member
    Join Date
    Jul 2010
    Location
    Phoenix, Arizona, usa
    Age
    74
    Posts
    54
    Rep Power
    20

    Is Long Signed or Unsigned?

    Is the LONG data type signed or unsigned?

  4. #4
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,155
    Rep Power
    736
    Hi,

    LONG is signed. To keep the "Did you know" spirit... did you know you can use name Int32 in ThinBASIC for signed 32bit integer as well?

    The "ununsigned" in Eros post might be double negation


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  5. #5
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,818
    Rep Power
    10
    sidramalik100 user seems making posts just for speading signature ads but because signature is only possible after making some more posts it does not appear. Anyway I will give some time and see.

    Well "ununsigned" can be a neologism isn't it?
    The problem is understanding how to use

    Anyway, fixed.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •