Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Promote project's standards to C++17 #284

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tcoyvwac
Copy link
Contributor

  • As titled. 🎉
  • Many greater benefits compared to C++11, especially to do with constexpr, lambdas, and standard algorithms.
  • This gives developers tools to refactor the codebase and to express intent of code, in a much more simple way, (with a focus) to other developers reading the project's code.

@tcoyvwac
Copy link
Contributor Author

tcoyvwac commented Dec 25, 2022

Due to a discovery in building PR:#319; because of an interesting characteristic highlighted during the Build (windows-latest) CI chain, this PR may have a follow-up PR to be promoted to C++20! 🚀


Explanation:
It seems that Build (windows-latest) is quite "strict" with some C++ nice features which other compilers accept pre-C++20! 😞

This feature is called "Designated Initializer Lists"


So condensely explained, instead of being able to write the terse shortform: 🥲

union render_pass_args_t { // <-- [2]: Note: can use the union datatype for a bonus combo!
    const vera::Fbo* const fbo;
    const BuffersList* const fbolist;  // using BuffersList = std::vector<vera::Fbo*>;
};
struct vtable_render_pass_t{
    using func_sig_t = auto (*)(const std::string&, Uniforms&, const render_pass_args_t&, render_ui_t&)-> void;
    const std::string prompt_id;
    const render_pass_args_t process_info;
    const func_sig_t process_render_pass;
};
const auto render_pass_table = { vtable_render_pass_t
    {"u_buffer", {}, do_pass_singlebuffer}
    , {"u_scene", {&m_sceneRender.renderFbo}, do_pass_scene}
    , {"u_sceneBuffer", {.fbolist = &m_sceneRender.buffersFbo}, do_pass_scenebuffer} // <-- [1] for "Build (windows-latest)", this is "technically" a c++20 feature.
    , {"u_sceneDepth", {&m_sceneRender.renderFbo}, do_pass_scenedepth}
};

...we must be "strict" and write the very bluntish and verbose longform! (For Build (windows-latest) to be happy!) 😱

struct render_pass_args_t {  // <-- [2]: Warning: strict-mode C++11, and so we have to use struct datatype declaration!
    const vera::Fbo* const fbo;
    const BuffersList* const fbolist;  // using BuffersList = std::vector<vera::Fbo*>;
};
struct vtable_render_pass_t{
    using func_sig_t = auto (*)(const std::string&, Uniforms&, const render_pass_args_t&, render_ui_t&)-> void;
    const std::string prompt_id;
    const render_pass_args_t process_info;
    const func_sig_t process_render_pass;
};
const auto render_pass_table = { vtable_render_pass_t
    {"u_buffer", {nullptr, nullptr}, do_pass_singlebuffer}
    , {"u_scene", {&m_sceneRender.renderFbo, nullptr}, do_pass_scene}
    , {"u_sceneBuffer", {nullptr, &m_sceneRender.buffersFbo}, do_pass_scenebuffer} // <-- [1]: Boo. :( All fields must be declared for everything, to make "Build (windows-latest)" happy!
    , {"u_sceneDepth", {&m_sceneRender.renderFbo, nullptr}, do_pass_scenedepth}
};

If programming (OO) is all about "message passing"[1], it's disappointing and unfortunate that this nice feature is hidden behind C++20 on Build (windows-latest)! 😞

  1. https://en.m.wikipedia.org/wiki/Smalltalk#History

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant