});
}
```
The function C_testPrint loops over its argument x and prints out one
value
of x at each loop. The loop starts from the second element and ends
in the
fifth element of x. I also redefine the buffer size to see the effect of
it. Here is my R code:
R code
```
C_testPrint(as.numeric(1:10))
idx: 1, i: 0, ptr:2.000000
idx: 1, i: 1, ptr:3.000000
idx: 3, i: 0, ptr:4.000000
idx: 3, i: 1, ptr:5.000000
C_testPrint(c(1,2,3,4,5,6,7,8,9,10))
idx: 1, i: 0, ptr:1.000000
idx: 1, i: 1, ptr:2.000000
idx: 1, i: 2, ptr:3.000000
idx: 1, i: 3, ptr:4.000000
idx: 1, i: 4, ptr:5.000000
```
There are two problems in the outputs:
1. The numbers of lines are different
2. The starting indices are not the same.
From my understanding, the first output seems correct to me. The
second is
not unexpected. I believe the differences are due to the
accessibility of
the data pointer. Did I misunderstand and misuse the macro? Or is it
a bug
in R? Here is my session info. My R is a bit outdated but the macro
seems
unchanged in R 4.0. Thanks
```
sessionInfo()
R Under development (unstable) (2019-08-22 r77060)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
```
[[alternative HTML version deleted]]
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel