[GPE] Coding Style Discussion: gp vs GP Naming Convention (C/C++)
#1
Replies: 2 comments 2 replies
-
|
An other solution is to have a new coding style that utilize:
prefixes for classes types (optional, can get confusing over time):
namespace GP::Math
{
template <GP::Concepts::IsFloatingPoint T> // or GP::IsFloatingPoint
struct Matrix4x4
{
private:
GP_ALIGNAS(16) T m_data[16];
public:
...
public:
GP_NODISCARD constexpr Matrix4x4<T> getRowMajor() noexcept {...}
GP_NODISCARD constexpr Matrix4x4<T> getColumnMajor() noexcept {...}
};
}
int main(int argc, char* argv[])
{
GP::Application application;
application.processArguments(argc, argv);
auto window = GP::Platform::Window::Create();
GP::Math::Matrix4x4<GP::Float32> transform;
window.setTransform(transform.getRowMajor());
while (window.isOpen())
{
GP::Platform::PollSystemEvents();
window.dispatchEvents();
window.display();
}
}WDYT ? PS: Or an alternative will be to keep namespaces single-word and in lowercase to contrast between the Classes and the namespaces (add an emoji to this post if you agree with this) |
Beta Was this translation helpful? Give feedback.
-
|
Nicehhhh, while the first option is certainly faster to code, the second seems offers better readability. Since our goal is to build an 'open' engine, I guess it's better to prioritize an approach that facilitates understanding for future contributors right from the start even if it requires a slight learning curve at first, the second visual structure allows for instant identification of each element's role, which will greatly simplify long-term maintenance (that's a good things for me xD). |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone 👋
Following the discussion in the initial coding style issue, I’d like to gather broader feedback on the preferred naming convention for the engine.
The main question is:
Option A:
gp(lowercase + STL-like style)This approach is closer to STL / modern C++ conventions.
std, etc.)⚡ Option B:
GP(PascalCase / Unreal-like style)This approach is closer to engines like Unreal / enterprise C++.
🧬 Extended Example: Core Types
gpstyleGPstyle💬 Discussion Points
Thanks for your feedback 🙌
4 votes ·
Beta Was this translation helpful? Give feedback.
All reactions