c_api.cc variable declared inapproiate (#3044)

In line 461, the "size_t offset = 0;" should be declared before any calculation, otherwise will cause compilation error. 

```
I:\Libraries\xgboost\src\c_api\c_api.cc(416): error C2146: Missing ";" before "offset" [I:\Libraries\xgboost\build\objxgboost.vcxproj]
```
This commit is contained in:
Abraham Zhan 2018-02-09 17:32:01 +08:00 committed by Philip Cho
parent d878c36c84
commit 874525c152

View File

@ -406,6 +406,7 @@ void prefixsum_inplace(size_t *x, size_t N) {
suma[0] = 0;
}
size_t sum = 0;
size_t offset = 0;
#pragma omp for schedule(static)
for (omp_ulong i = 0; i < N; i++) {
sum += x[i];
@ -413,7 +414,6 @@ void prefixsum_inplace(size_t *x, size_t N) {
}
suma[ithread+1] = sum;
#pragma omp barrier
size_t offset = 0;
for (omp_ulong i = 0; i < static_cast<omp_ulong>(ithread+1); i++) {
offset += suma[i];
}