What is the easiest / most efficient way to initialize these doubling blocks, preferably at compile time:
#define N 1000 double mul1[N][N] __attribute__ ((aligned (64))); double mul2[N][N] __attribute__ ((aligned (64)));
They are used for test data for " const" only.
const
There is a GCC function (not standard C!) Called Assigned Initializers
For a 1D array, this will be simple:
double array[N] = {[0 ... (N-1)] = MY_DOUBLE_VALUE};
For 2D, a little harder:
double array[N][N] = { [0 ... (N-1)] = {[0 ... (N-1)] = MY_DOUBLE_VALUE}};
The initialization of a static array (which I accept is what you want) is ALWAYS performed at compile time, so you initialize them just like any other array.
, , make.
- , Boost.Preprocessor. BOOST_PP_WHILE BOOST_PP_ARRAY_PUSH_FRONT.
, :)
. ?
- . ?
int i, j; for (i = 0; i < N; ++i) { for (j = 0; j < N; ++j) { mul1[i][j] = INITIAL_VALUE_1; mul2[i][j] = INITIAL_VALUE_2; } }
, ? , ?
Source: https://habr.com/ru/post/1726787/More articles:Expose ContentPlaceHolder in User Control - validationis there a site offering a localized overview of all alternative browsers - browserSetting a location other than 0.0 when Dock = Fill - winformsListing Index Values - javaCakePHP drops session between pages - phpJquery close function - jquerySQL Select aggregated values in a column - sqlЭкстремальное программирование большого/малого числа - c++How to free free code? - licensingTesting with multiple regular expressions at the same time (for use in parsing) - javascriptAll Articles