Debian Codegraph @

cmake/cxx_tests/nceg_restrict.cpp

raw
1 // DESCRIPTION
2 //
3 // Test to check whether the C++ compiler supports the Numerical C Extensions Group restrict
4 // keyword.
5 //
6 // In sync with AC_CXX_NCEG_RESTRICT (2008-04-12).
7 // !! Replaced by AC_C_RESTRICT in Autoconf 2.58.
8 //
9 // COPYLEFT
10 //
11 // Copyright (c) 2009 Theo Papadopoulo <[email protected]>
12 // Copyright (c) 2008 Todd Veldhuizen
13 // Copyright (c) 2008 Luc Maisonobe <[email protected]>
14 //
15 // Copying and distribution of this file, with or without modification, are
16 // permitted in any medium without royalty provided the copyright notice
17 // and this notice are preserved.
18
19 void add(int length,double* restrict a,const double* restrict b,const double* restrict c) {
20 for (int i=0;i<length;++i)
21 a[i] = b[i]+c[i];
22 }
23
24 int main() {
25 double a[10],b[10],c[10];
26 for (int i=0;i<10;++i) {
27 a[i] = 0.0;
28 b[i] = 0.0;
29 c[i] = 0.0;
30 }
31 add(10,a,b,c);
32 return 0;
33 }