Archived

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

dalleboy

Why int instead of named enums?

Recommended Posts

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
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