Remix.run Logo
ryao 14 days ago

They replaced C with C++. For example, try passing a function pointer as a void pointer argument without a cast. C says this should work. C++ says it should not. There are plenty of other differences that make it C++ and not C, if you know to look for them. The fact that C++ symbol names are used for one, which means you need to specify extern “C” if you want to reference them from the CUDA driver API. Then there is the fact that it will happily compile C++ classes where a pure C compiler will not. There is no stdc option for the compiler.

pjmlp 13 days ago | parent [-]

They replaced most of the documentation with C++ examples, given the benefits the language has over C, that was already obvious to me in 1993.

As for the language extensions required by CUDA C, it is kind of interesting that clang and GCC extensions are praised and people keep referring to them as C, while everyone else's extensions are never C or C++ under the same measure.

With OpenAAC directives, an HPC industry standard, you can make use of plain old C11 with traditional #pragmas,

https://developer.nvidia.com/openacc

ryao 12 days ago | parent [-]

I used to like C++. Then it caused me headaches one too many times because of things it implemented that C did not have. Now I prefer to use C whenever I can, since it avoids entire classes of headaches that only exist in C++.