Overv / VulkanTutorial

Tutorial for the Vulkan graphics and compute API
https://vulkan-tutorial.com
Creative Commons Attribution Share Alike 4.0 International
3.14k stars 514 forks source link

Consider rewriting the tutorial using plain C #106

Closed sandeep-datta closed 6 years ago

sandeep-datta commented 6 years ago

Hi, please consider rewriting the tutorial using plain C (optionally with the use of C++ RAII) to keep the focus of the learner on Vulkan and away from C++ issues.

For example this code fragment from the Base Code chapter is not exception safe...

void run() {
    initVulkan();
    mainLoop();
    cleanup();
}

The call to cleanup() will be skipped if initVulkan() or mainLoop() throws an exception.

Exceptions are a C++ specific thing. It is just a distraction while learning Vulkan.

Overv commented 6 years ago

What would you suggest I replace the exceptions with? Return code handling everywhere?

I agree with you that cleanup could be handled better and should be called even in the case of exceptions, but I don't see any reason to drop the (very minimal) use of C++ features.

sandeep-datta commented 6 years ago

Return code handling everywhere?

Isn't Vulkan a C API? Do you not have to handle return codes anyway?

sandeep-datta commented 6 years ago

I don't see any reason to drop the (very minimal) use of C++ features.

Sure, no problem. I will close this issue.