How do I write a callback function that will get called at a rate that I can define? |
|
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) |
|
April Ryan is my friend,
Every sorrow she can mend.
When i visit her dark realm,
Does it simply overwhelm.
How do I write a callback function that will get called at a rate that I can define? |
|
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. |
|
Last edited by ninja9578; 02-05-2010 at 09:48 PM.
Callbacks are just regular methods. All a method is is a pointer to a bit of code, nothing more, so you can store a pointer to a method just like to store a pointer to an object. |
|
function pointers are a good thing to get your head around for advanced stuff. |
|
(\_ _/)
(='.'=)
(")_(")
I'm looking for a cross-platform library implementing network connections, and a good guide on how to use it. If boost has such networking functionality that's be good. |
|
April Ryan is my friend,
Every sorrow she can mend.
When i visit her dark realm,
Does it simply overwhelm.
Yes, Boost has a network library. Boost Network |
|
also have a look at QT |
|
(\_ _/)
(='.'=)
(")_(")
wxWidgets too. I prefer wx because it's got a huge community for support, whereas Qt used to be a commercial product, so support is limited. |
|
I changed my mind about wxWidgets. Don't use it, it's given me my last headache, I'm writing my own library from scratch, if anyone wants to help, let me know. |
|
Okai, I have a question... again :p |
|
April Ryan is my friend,
Every sorrow she can mend.
When i visit her dark realm,
Does it simply overwhelm.
Well, there is a better way to do it, it's always best to allocate memory that goes together all at once. Remember, using a C-cast you can change anything into anything else. |
|
Wow, quick reply |
|
April Ryan is my friend,
Every sorrow she can mend.
When i visit her dark realm,
Does it simply overwhelm.
No, using C functions is very common. C functions are very very fast. Don't use C headers. ie #include <ctime> instead of #include <time.h> |
|
Oops. I forgot a const at operator |
|
Mostly, yeah. But I don't get why you use assert. I thought the point of an assert statement was to halt program execution. Would it not be more suitable to use an if statement? |
|
April Ryan is my friend,
Every sorrow she can mend.
When i visit her dark realm,
Does it simply overwhelm.
Yes, asserts halt operation, but only in debugging mode. In release mode, they are compiled out, so no checks are done. This helps you make your code correct before you release it. |
|
const essentially means "read only" so |
|
Okai, I understand. Thanks |
|
April Ryan is my friend,
Every sorrow she can mend.
When i visit her dark realm,
Does it simply overwhelm.
I thought I should pop up a slightly old thread for this problem I'm having. |
|
-- My Videos --
DILD Tutorial| |WILD Tutorial| |DEILD Tutorial| |Lucid Dreaming is The DEVIL?!
Reality Check! (new)| |Why you're not getting LUCID| |Why NOT to be Scared of SP
My guess is that you are using an event table for this, I would recommend connecting your events and disconnecting them manually. |
|
A series of stupified attempts brought me to this equally stupid one. |
|
-- My Videos --
DILD Tutorial| |WILD Tutorial| |DEILD Tutorial| |Lucid Dreaming is The DEVIL?!
Reality Check! (new)| |Why you're not getting LUCID| |Why NOT to be Scared of SP
Bookmarks