Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. syntax question

syntax question

Scheduled Pinned Locked Moved C / C++ / MFC
question
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    boon kian
    wrote on last edited by
    #1

    Hi I have some syntax question which is bothering me. Can someone pls explain to me what these codes means or where to find answer to question with regards to syntax ? (I have access to MSDN library but I am still unable to find a satisficatory answer from there) 1. BOOL BOAPI ShowMessage (int, int) what does this function syntax means ?? esp BOAPI is it a data type ? something to do with dll convention ?? 2. #typedef bool (TYPEOF_InitP) (int *a); what does this syntax means ?? does it mean let TYPEOF_InitP be a function that return bool and take in 1 int variable ?? PLease advise. Thank you !! bk

    M 1 Reply Last reply
    0
    • B boon kian

      Hi I have some syntax question which is bothering me. Can someone pls explain to me what these codes means or where to find answer to question with regards to syntax ? (I have access to MSDN library but I am still unable to find a satisficatory answer from there) 1. BOOL BOAPI ShowMessage (int, int) what does this function syntax means ?? esp BOAPI is it a data type ? something to do with dll convention ?? 2. #typedef bool (TYPEOF_InitP) (int *a); what does this syntax means ?? does it mean let TYPEOF_InitP be a function that return bool and take in 1 int variable ?? PLease advise. Thank you !! bk

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      boon kian wrote: BOOL BOAPI ShowMessage (int, int) That entirely depends on what the BOAPI macro is defined as. It's probably a calling convention such as __stdcall boon kian wrote: #typedef bool (TYPEOF_InitP) (int* a); Assuming the # is a typo, that still isn't legal AFAICT. If you meant typedef bool (*TYPEOF_InitP) (int *a); then that means TYPEOF_InitP is a function pointer, that can point to functions that take an int* parameter and return a bool. --Mike-- Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber "That probably would've sounded more commanding if I wasn't wearing my yummy sushi pajamas."   -- Buffy

      B 1 Reply Last reply
      0
      • M Michael Dunn

        boon kian wrote: BOOL BOAPI ShowMessage (int, int) That entirely depends on what the BOAPI macro is defined as. It's probably a calling convention such as __stdcall boon kian wrote: #typedef bool (TYPEOF_InitP) (int* a); Assuming the # is a typo, that still isn't legal AFAICT. If you meant typedef bool (*TYPEOF_InitP) (int *a); then that means TYPEOF_InitP is a function pointer, that can point to functions that take an int* parameter and return a bool. --Mike-- Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber "That probably would've sounded more commanding if I wasn't wearing my yummy sushi pajamas."   -- Buffy

        B Offline
        B Offline
        boon kian
        wrote on last edited by
        #3

        Hi Mike, Thank you. But i still have some doubts to clarify: BOOL BOAPI ShowMessage (int, int) is a function. So when u need to call the function, u would do a normal ShowMessage (1,2) rite ? But when you call the function am i rite to say that a BOAPI macro would run first follow by the ShowMessage function ? If not, when would the BOAPI macro runs or how is it been used? Sorry for my poor command of the c-language. Please advise. Thank you. bk (btw u are rite abt the # typo and the missing * could also be a typo from the original source)

        S 1 Reply Last reply
        0
        • B boon kian

          Hi Mike, Thank you. But i still have some doubts to clarify: BOOL BOAPI ShowMessage (int, int) is a function. So when u need to call the function, u would do a normal ShowMessage (1,2) rite ? But when you call the function am i rite to say that a BOAPI macro would run first follow by the ShowMessage function ? If not, when would the BOAPI macro runs or how is it been used? Sorry for my poor command of the c-language. Please advise. Thank you. bk (btw u are rite abt the # typo and the missing * could also be a typo from the original source)

          S Offline
          S Offline
          Steve S
          wrote on last edited by
          #4

          Yes, it's a normal function, so ShowMessage( 1, 2) would "work". In this instance, I think it's more likely that BOAPI is a simple text substitution, to something like __stdcall, as Mike has already said. This makes the code look like this BOOL __stdcall ShowMessage(int, int) which just says how the stack is used in terms of pushing params and cleaning up. There is no additional code to be executed. Steve S

          B 1 Reply Last reply
          0
          • S Steve S

            Yes, it's a normal function, so ShowMessage( 1, 2) would "work". In this instance, I think it's more likely that BOAPI is a simple text substitution, to something like __stdcall, as Mike has already said. This makes the code look like this BOOL __stdcall ShowMessage(int, int) which just says how the stack is used in terms of pushing params and cleaning up. There is no additional code to be executed. Steve S

            B Offline
            B Offline
            boon kian
            wrote on last edited by
            #5

            Hi Steve and Mike Thanks a lot !! I think i roughly get the idea already ! bk

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups