Hi ,all
I would like to initailize an array in root terminal using this way : int d[40]=100
but I could not get the correct return result [100, 100, 100, 100, 100…]
instead get the figure below. I wonder it is normal?
Many Thanks!
Thanks so much. I know the principle . Another question confusing me . I wonder why a[1] a[2] a[3] printing value 2 below? Thanks so much!
Which operating system, which ROOT version.
I do not see this effect with recent ROOT versions (on MacOS):
% root
------------------------------------------------------------------
| Welcome to ROOT 6.27/01 https://root.cern |
| (c) 1995-2022, The ROOT Team; conception: R. Brun, F. Rademakers |
| Built for macosx64 on Nov 24 2022, 06:43:42 |
| From heads/master@v6-25-02-2828-g33beda7d0d |
| With Apple clang version 14.0.0 (clang-1400.0.29.202) |
| Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q' |
------------------------------------------------------------------
root [0] int a[40] = {2}
(int [40]) { 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
root [1] a[0]
(int) 2
root [2] a[1]
(int) 0
root [3]
The version is 6.24.00. OS is windows 10.The compiler provided by visual studio
That’s a known issue. See [cling,win32] Read-after-write of variable of type `double` does not yield the correct result · Issue #9809 · root-project/root · GitHub
1 Like
OK,thanks!
Thanks!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.