• Lucid Dreaming - Dream Views




    Results 1 to 25 of 102
    Like Tree3Likes

    Thread: Ask me about C / C++

    Threaded View

    1. #11
      Banned
      Join Date
      Apr 2007
      Location
      Out Chasing Rabbits
      Posts
      15,193
      Likes
      935
      Quote Originally Posted by khh View Post
      Yeah. That's not at all how I imagined they would work, but it seems fairly logical now that you present the idea. (Though I had to look spend some time just looking the code over and mentally executing it to get the picture :p)

      How would you include user defined functions? One way of doing it could be to just paste the code for each time it's used (like inline functions), but how would you get proper functions?
      Also, I'm guessing it would be pretty essential to implement a syntax checker?
      I actually don't implement a syntax checker, my company has a dev-staging-live process, my app is live so it's assumed that everything is correct when it gets to me.

      I do implement inline functions in that very way, and as for user defined real functions, well, my current language doesn't support those at this time, but I plan to add them in the very near future. They aren't that difficult. Basically, you would just replace a call to that function with something like @UserDefined(<place>) during a preprocessing pass. Then when you compile your callbacks, you have it point to the function that you've defined.

      Yeah, scripting languages are weird things, and difficult to start implementing, but once you've done a few of them, you can write pretty advanced ones really quickly.

      Quote Originally Posted by Artelis View Post
      How do I write a callback function that will get called at a rate that I can define?
      You mean in a scripting language, or in C++?
      Last edited by ninja9578; 02-05-2010 at 09:48 PM.

    Bookmarks

    Posting Permissions

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