In my Kernel file .cl, I define several functions with the same name, but have different numbers and types of parameters. The excecution always failed until I named those functions differently. Doesn't anyone have the same experience?
I wonder if OpenCL support "class" and "derived class", which are very popular in C++.
OpenCL is based on C, not C++. It doesn't support polymorphism or classes, it's not object oriented.
Originally posted by: edwen
In my Kernel file .cl, I define several functions with the same name, but have different numbers and types of parameters. The excecution always failed until I named those functions differently. Doesn't anyone have the same experience?
I wonder if OpenCL support "class" and "derived class", which are very popular in C++.
Btw, I tried a custom mechanism ( ala GObject ) using C function pointers, but it neither supports them so it's impossible to get polymorphism, sorry.
On the other hand, I think you are referring to function parameter's overriding which is a completely different thing... but C does not support it, you must change the function's name.
Those things together with templates reminds me each day why C is really awful and why OpenCL 2.0 should support C++.
That's right. It's actually overriding, instead of polymorphism. If OpenCL doesn't support Classes, it shouldn't support that, either. Is OpenCL going to support C++ in the near future?
Originally posted by: bubu
Those things together with templates reminds me each day why C is really awful and why OpenCL 2.0 should support C++.
<Rant>
Funny that. After trying everything from Assembler to .NET and back, I've rediscovered the beauty and simplicity of C. And guess what's occupying the other end of my preference list. It's that overgrown, one-language-to-rule-them-all (and then some), Mess++ we all love so much.
The last thing, I'd like to see, is GPUs burried in layers and layers of templates, inheritance, polymorphism, constructor chains and virtual function tables.
What a joy...
</Rant>
OpenCl can support many c++ features using c++ bindings.
http://www.khronos.org/registry/cl/