Draft: Porting from C to Cpp using Multidimensional Subscript Operator
Open
requested to merge develop_PortingFromCToCpp_MultidimensionalSubscriptOperator into develop_porting_from_c_to_cpp
In ifos3d a 3D field e.g. vx
is represented by the type float ***
.
-
vx
is an array of sizenrow
with elements of typefloat **
-
vx[.]
is mapped to an array of sizenrow * ncol
with elements offloat *
-
vx[.][.]
is mapped to an array ofnrow * ncol * ndep
with elements offloat
- As the index of the fields may not start at zero, this data structure requires to substract offsets from the pointers, which may lead to pointer underflows.
With C++ multidimensional subscript operators this pointer underflow problem can be avoided and also the memory for the pointer structure can be saved.
Edited by Holger Obermaier
Merge request reports
Activity
Please register or sign in to reply