Clang provides extensions not found in ISO standard C or C++, including support for a large range of GCC extensions.
Questions tagged [clang-extensions]
6 questions
8
votes
5 answers
How do Clang 'blocks' work?
http://clang.llvm.org/docs/BlockLanguageSpec.txt
Looks really cool.
However,
I don't understand it.
I don't see examples it.
I don't see examples of ideas hard to express in C++ as is, but trivial to express in blocks.
Can anyone enlighten me on…

anon
- 41,035
- 53
- 197
- 293
8
votes
2 answers
Are variable length arrays there in c++?
I had always thought that variable length arrays were not allowed in c++(Refer :Why aren't variable-length arrays part of the C++ standard?) .But than why does this code compile and work?
#include
using namespace std;
int main () {
…

nikhil_vyas
- 513
- 5
- 16
3
votes
0 answers
Clang built-in vector type extension: alignment question and checking that it actually works
I am interested in using the clang vector extension such as:
typedef float vec3 __attribute__((ext_vector_type(3)));
I have 2 questions:
As you can see in the example above and below, I am primarily interested in using them for manipulating vec3…

user18490
- 3,546
- 4
- 33
- 52
3
votes
2 answers
Clang's __has_builtin doesn't always work
With respect to the following test code, the expected outcome was that it wouldn't compile because of the #error directive.
#if __has_builtin(__builtin_types_compatible_p)
#error ("Hello")
#endif
#include
int main (void)
{
if…

strNOcat
- 913
- 2
- 8
- 22
1
vote
0 answers
Clang built-in matrix and vector extension: efficient matrix-vector multiplication
I am writing a small graphics 3D app, to learn about Clang vector and matrix extensions (matrices still seem to be developed if I read the right versions of the doc).
I am unsure about how to write the most efficient code for a matrix-vector…

user18490
- 3,546
- 4
- 33
- 52
1
vote
1 answer
c++ constant type conversion in arithmetics
Background
I am trying to learn in C++11 with clang on mac.
Question
As it is said in the book, when float type meets int or lower case in arithmetic, the latter will be converted to float. It is true in cases like:
cout << 9.0 / 5 << endl;
The…

Archimedes520
- 191
- 1
- 9