compiling problem when play with the False sharing example
Thu Jun 25 02:13
Dear All,
When I try to understand the False sharing concept and play with the example in the lecture, I can't compile it, neither on my Mac nor on the teach cluster.
The error message is as follows:
(base) ➜ OpenMP101 gcc-9 -fopenmp FalseSharing.c
FalseSharing.c: In function 'main':
FalseSharing.c:5:11: error: 'new' undeclared (first use in this function)
5 | int *x = new int[100];
| ^~~
FalseSharing.c:5:11: note: each undeclared identifier is reported only once for each function it appears in
FalseSharing.c:5:15: error: expected ',' or ';' before 'int'
5 | int *x = new int[100];
| ^~~
FalseSharing.c:14:2: error: 'delete' undeclared (first use in this function)
14 | delete [] x;
| ^~~~~~
FalseSharing.c:14:10: error: expected expression before ']' token
14 | delete [] x;
| ^
I am not familiar with C, so can anyone give me some help on this?
Best,
Yao