some newbie questions

Hi!

I hope this is the right way to ask some newbie-questions about clang.

1. which option (clang::LangOptions) controls the overloading feature?
(e.g. int foo(int x); int foo(float x):wink:
is it possible to create a c-compiler with just overloading enabled additionally?

2. do I have to typedef vector types myself also in x=cl mode?
(e.g. typedef __attribute__(( ext_vector_type(4) )) float float4;)

3. how to I create a vector type in a expression? I want to write
a = b * float4(1, 2, 3, 4);
I get error: function-style cast to a builtin type can only take one argument.
Where can I patch this and would a patch be welcome or has it some
reason that it does not work?

4. how can I control the size of the builtin types (int, long etc.)?
I want to set long to 64 bit independent of the target architecture.

thanks and with kind regards,
jochen

Hi!

I hope this is the right way to ask some newbie-questions about clang.

1. which option (clang::LangOptions) controls the overloading feature?
(e.g. int foo(int x); int foo(float x):wink:
is it possible to create a c-compiler with just overloading enabled
additionally?

There is no specific LangOptions flag for overloading, although of course it is available whe CPlusPlus is set.

That said, there is an "overloadable" attribute that permits overloading in C. It is documented on Clang's language extensions web page, and is used by C99's <tgmath.h> and OpenCL.

2. do I have to typedef vector types myself also in x=cl mode?
(e.g. typedef __attribute__(( ext_vector_type(4) )) float float4;)

Yes.

3. how to I create a vector type in a expression? I want to write
a = b * float4(1, 2, 3, 4);
I get error: function-style cast to a builtin type can only take one
argument.
Where can I patch this and would a patch be welcome or has it some
reason that it does not work?

Put parentheses around "float4"?

4. how can I control the size of the builtin types (int, long etc.)?
I want to set long to 64 bit independent of the target architecture.

I think you either have to pick an architecure with 64-bit longs or create your own variant of an similar architecture (then override the size of long).

   - Doug