🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Any future problems from naming my math lib with unscoped v2, v3, v4, m3, m4?

Started by
13 comments, last by ddlox 3 years, 3 months ago

JoeJ said:

SuperVGA said:
mind me asking why are you getting rid of GLM?

One argument may be performance: https://www.gamedev.net/forums/topic/709305-glm-vs-vs2019-for-simd/

Huh - well that's a surprise! I'm using GLM all across my project, but I rarely apply anything but my own functions - I just use their classes. I suppose it wouldn't be a lot of work to implement some of that elsewhere and reap the benefits...

Advertisement
 
typedef some_library::their_nested_namespace::ColumnVector<double,3> v3;

Omae Wa Mou Shindeiru

Gnollrunner said:
In my code I have some sequence of capital letters that prefixes anything that's global

Maybe it's because I'm from a C# background but this is a pain in my eyes. I know it is widely used by some major projects like our in-house engine or Unreal Engine as well but to me it is a pain in the a. There is nothing wrong about using well chosen namespaces and explicit include statements.

All of our (hobby) engine project is scoped like this. We have a namespace for everything we need in the core but that's not meant to be by the user/developer in it's own namespace and everything else in the global engine namespace. Our tool generates projects in a way that we're always able to include from the project head and so we can also “scope” our include statements for example by category (Common, Math, Storage, Graphics etc.) as everything ins categorized by a subfolder.

fleabay said:
just want to switch it to be v3 etc

If you are using it on your own, this might be ok but at the moment another person is using your code, you should consider keeping it that way you already have. vec3 and mat4 are commonly used but nobody will know what a v3 data type is

@fleabay stick with namespaces, in the future you might have the need to create another vX of the same name, the namespace will resolve this:

// pseudo
namespace ke
{
  class v2  // my 2D vector class
  ...
}

namespace pe
{
 class v2 // my 2D velocity class
 ...
}

also, the C++ Standard keeps improving, you don't know what added benefits you might get with namespace ?

the syntax "using foo::bla" is really there to help, but don't use it at global space nor in header files (as it might introduce collision), use it more at local space;

keep the faith ?

This topic is closed to new replies.

Advertisement