Jump to content
  • Advertisement

Archived

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

dalleboy

Why int instead of named enums?

This topic is 5426 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

Advertisement
Well, if its in an interface which may be used by C or other languages, then ints are more standard.

Enums are generally a better solution, but in big systems can be problems because you can''t forward declare them -- they lead to twisted dependencies.

I would go with the enum as they are just simpler and less error prone, unless I had a really good reason not to.

Share this post


Link to post
Share on other sites
Does it _really_ matter? This interface is not set in stone and is very susceptible to changes anyway. Besides, those particular enums are assigned values equivalent to int's.. (4 byte integer values).

Share this post


Link to post
Share on other sites
quote:
Original post by dalleboy
Why insist of using for example TurnLeft(int rate) instead of TurnLeft(TurnRate rate)


Why insist on using enum??

Just a curious thought!?



____________________________________________________________
Try RealityRift at www.planetrift.com
Feel free to comment, object, laugh at or agree to this. I won''t engage in flaming because of what I have said.
I could be wrong or right but the ideas are mine.

Share this post


Link to post
Share on other sites
quote:
Original post by BrianL
Well, if its in an interface which may be used by C or other languages, then ints are more standard.

Perhaps true, but the GDArena uses C++ virtual member functions, so the interface is not really meant for any other language than C++.

(I know that virtual functions exist in other languages and can be implemented even in C, but ain''t that a bit harder than implementing enums?)

[How To Ask Questions|STL Programmer''s Guide|Bjarne FAQ|C++ FAQ Lite|C++ Reference|MSDN]

Share this post


Link to post
Share on other sites
quote:
Original post by dalleboy
Why insist of using for example TurnLeft(int rate) instead of TurnLeft(TurnRate rate)


Personnel preference. Usually the reason behind most things.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!