Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Matt Calabrese

Dereferencing Function Pointers

This topic is 5857 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''ve always read that if you had a function pointer: void (*Blah)(); You had to call it by dereferencing the pointer first: (*Blah)(); However, I''ve noticed that in MSVC++ 6.0 my code compiles and runs fine just doing Blah(); Also, when initializing a function pointer, I always read that you had to explicitly reference the function: void (*Blah)() = &SomeFunction; But in MSVC++ 6.0 I am able to do void (*Blah)() = SomeFunction; Are these actually standard, or are they just microsofts doing? I like the implicit refrencing and dereferencing, but I don''t want to do it if it won''t compile on other compilers. Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Function pointers are automatically dereferenced.

You can test for standard-conforming code using Comaeu Computing''s Online Compiler.

Also, download Dev C++, which is a decent IDE for windows that uses gcc & mingw, which gives you another compiler to check code against. However, bare in mind that gcc implements a number of extentions.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!