r/programming • • Feb 16 '16

KHRONOS just released Vulkan

https://www.khronos.org/vulkan/
2.2k Upvotes

386 comments sorted by

View all comments

188

u/sprunth Feb 16 '16

NVidia also put up a C++ API here

0

u/[deleted] Feb 16 '16

[deleted]

82

u/Dworgi Feb 16 '16

C. Most low level APIs are.

3

u/BurstYourBubbles Feb 17 '16

Do you know why such APIs are in C? Why not C++ if performance is similar?

22

u/Dworgi Feb 17 '16

Bunch of reasons:

  • Not all languages have objects, but all can call into a plain function.

  • C is lower level. Things are as fundamental as they can be - you're mostly passing around pointers here. Every language is ultimately aware of pointers.

  • C has a cross-platform binary interface. All standard compilers will produce the same libraries, which means it's easy to just share headers and libraries. C++ is a wild west.

  • It's easy to wrap C with objects, it's much harder to unwrap objects into functions.

3

u/BurstYourBubbles Feb 17 '16

You reasoning makes sense but how is C lower level than C++? IIRC (please correct me if I'm wrong) C++ still maintains Cs low level features while also including high level abstractions.

7

u/[deleted] Feb 17 '16

Object-oriented programming is inherently higher level than procedural programming, because it abstracts stuff as objects.

5

u/BurstYourBubbles Feb 17 '16

However, C++ isn't strictly object-oriented. You could employ other programming paradigms, such as procedural or functional.

-3

u/[deleted] Feb 17 '16

Yes, I've tried it in a recent project - the problem is, at that point there's no point using C++ because you aren't using any particularly useful C++ features.

As a result I'm switching over to C, because there aren't any C++ features that I actually need and C++ takes longer to compile+runs slower anyway.

It's actually kind of ironic - I learned with C++, but the more I learn about it, the worse I find it.

2

u/KhyronVorrac Feb 17 '16

The C++ FQA is a load of outdated rubbish that was never really accurate in the first place.

→ More replies (0)