Announcement

Collapse
No announcement yet.

PBDLL wish for next version

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

  • PBDLL wish for next version

    I think adding c's typedef would make programming easier and the
    code more readable.

    Code:
    #COMPILE EXE
    #INCLUDE "win32api.inc"
    
    '' c
    ' typedef unsigned LONG ULONG;
    
    '' pb
    typedef hWnd  AS LONG
    typedef hdc   AS LONG
    
    
    FUNCTION PBMAIN
        LOCAL hDlg AS hWnd
        DIALOG NEW 0, "hi",,, 250, 284,, TO hDlg
        DIALOG SHOW MODAL hDlg
    END FUNCTION
    ------------------

  • #2
    Hello,


    I second that request!


    I would also like to see..

    Code:
    #DEFINE [constant] AS [type]
    #UNDEF  [constant]
    and...

    Maybe even make PBDLL case sensitive?



    ------------------
    Cheers!

    Comment


    • #3
      Instead of using call dword i would like to see the typedef as in Borland.
      Than you can call the procedure using the declare directly instead of using call dword PTR.

      Looks a lot of explicit/implecit matter anyway..


      ------------------
      hellobasic

      Comment


      • #4
        {PERSONAL OPINION}
        This is *the* thing I hate most about reading other people's C code. I have to go digging through the headers to figure our what type a variable is supposed to be. I vote a strong *NO*.
        {/PERSONAL OPINION}
        Best Regards,
        Don


        [This message has been edited by Don Dickinson (edited April 20, 2001).]
        Don Dickinson
        www.greatwebdivide.com

        Comment


        • #5
          Don

          you have to dig through the header files because typedef is
          missing. I'd be happy with a simply typedef which let us name
          integer,, to Extended Currency whatever we want.

          Ralph

          ------------------

          Comment


          • #6
            Ralph,

            But BASIC isn't C is it? I think R&D has spoke up about
            this type of thing in the past.

            ------------------
            -Greg
            -Greg
            [email protected]
            MCP,MCSA,MCSE,MCSD

            Comment


            • #7
              I just wish I was a C programmer so I could tell what he's asking for..

              Code:
              typedef hWnd  AS LONG
              typedef hdc   AS LONG
              I kinda readable to me -- 'TypeDef' has replaced DIM. But whats' this?

              Code:
              ' typedef unsigned LONG ULONG;
              But Gregery's right, I think. This is basic, not C. And make it Case Sensitive? Eek!

              ------------------
              [email protected]
              http://www.northnet.org/bdurland
              Real programmers use a magnetized needle and a steady hand

              Comment


              • #8
                Bud --

                typedef means "define a data type". Doing this...

                Code:
                typedef HANDLE as LONG
                ...would then allow you to do this throughout your code...

                Code:
                DIM hWnd AS HANDLE
                typedef's are like "dumb" single-element TYPE structures, a way to give a native data type another name.

                IMO the main advantage is that it allows you (for example) to change an entire program from LONG handles to DWORD handles by changing one line of code. Of course it introduces the problem of "Now how did we define a HANDLE again...? In this program...?" You have to refer back to the DIM, which refers back to the typedef. If you use a relatively simple set of typedef's it's not too bad, because you can create your own Hungarian notation to keep track of everything. But it can make reading somebody else's code very difficult.

                The rough equivalent of a typedef can be accomplished in other ways using PowerBASIC, such as...

                Code:
                TYPE WINDOWHANDLE
                     hWnd AS LONG
                END TYPE
                ..then...

                Code:
                DIM MyWindow AS WINDOWHANDLE
                 
                MyWindow.hWnd = whatever
                I like doing it that way because it encourages me to add elements to a TYPE instead of creating new variables for everything...

                Code:
                TYPE WINDOWINFO
                     hWnd   AS LONG
                     lXPos  AS LONG
                     lYPos  AS LONG
                     lXSize AS LONG
                     lYSize AS LONG
                     '(ETC.)
                END TYPE
                -- Eric


                ------------------
                Perfect Sync Development Tools
                Perfect Sync Web Site
                Contact Us: mailto:[email protected][email protected]</A>

                [This message has been edited by Eric Pearson (edited April 20, 2001).]
                "Not my circus, not my monkeys."

                Comment


                • #9
                  Hi -

                  i don't want to join the holy war between BASIC,C,Pascal or
                  whatever programmers. Just thought it's a helpful idea.

                  Ralph

                  ------------------

                  Comment


                  • #10
                    Wouldn't it be easier if we call them macros? It would be great to be able to create text macros, they would take care of these typedefs too, and open up many other possibilities.

                    So, let's ask for macros instead.
                    Next thing on the list would be tooltips showing a macro's definition if you hover the mouse over one.


                    Peter.


                    ------------------
                    [email protected]
                    [email protected]

                    Comment


                    • #11
                      Me.. I dislike case sensitive items

                      I do like some other things c has but PB is not c

                      result = MyOpinion <> 'c'

                      --Barry

                      ------------------
                      Barry

                      Comment

                      Working...
                      X