cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

spectral
Adept II

Method overloading support ?

Hi,

Do you know if method overloading is expected in a future version of OpenCL.

For now I have to create several methods, like this :

float fresnell(float f1, float f2);

float fresnell2(float f1, float f2, float4 f3);

float fresnell3(float f1, float f2, float3 f3);

 

When, on the other side, all the native methods use overloading !!! Like "normalize" (double, float, floatn, doublen) ...

0 Likes
4 Replies
spectral
Adept II

Do you think that I can use something like this ?

 

#define my_fresnel(A) fresnel1(A)

#define my_fresnel(A,B) fresnel2((float2)(A,B))



 

I have try, but the compiler doesn't replace with the right "fresnelX" method based on the parameters. Is it normal ?

 

Thanks

0 Likes

I don't think that is allowed. I tried on my system and it gives macro redefinition error.

0 Likes
Marix
Adept II

Definetely my most missed feature. Sadly I see no hope for it to appear, as it would require some kind of name mangling as used in C++, definetly no longer C99. Only chance would be if there would be a move towards allowing the C-Subset of C++ instead of C99 as language basis.

0 Likes

Please bring this up with Khronos as a request and see where it goes from there.
0 Likes