DynArr are dynamically sized vector which may contain any type of variables.
More...
Detailed Description
DynArr are dynamically sized vector which may contain any type of variables.
These are the SimGrid version of the dynamically size arrays, which all C programmer recode one day or another.
For performance concerns, the content of DynArr must be homogeneous (in contrary to dictionnaries – see the Dict: generic dictionnary section). You thus have to provide the function which will be used to free the content at structure creation (of type void_f_ppvoid_t or void_f_pvoid_t).
Example with scalar
int i, cpt;
unsigned int cursor;
int *iptr;
for (cpt = 0; cpt < NB_ELEM; cpt++) {
}
for (cursor = 0; cursor < NB_ELEM; cursor++) {
"The retrieved value is not the same than the injected one (%u!=%d)",
cursor, cpt);
}
"The retrieved value is not the same than the injected one (%u!=%d)",
cursor, cpt);
}
for (cpt = 0; cpt < NB_ELEM; cpt++) {
"The retrieved value is not the same than the injected one (%d!=%d)",
i, cpt);
}
Example with pointed data
int cpt;
unsigned int iter;
char buf[1024];
char *s1, *s2;
for (cpt = 0; cpt < NB_ELEM; cpt++) {
sprintf(buf, "%d", cpt);
s1 = strdup(buf);
}
sprintf(buf, "%u", NB_ELEM - iter - 1);
"The retrieved value is not the same than the injected one (%s!=%s)",
buf, s1);
}
for (cpt = 0; cpt < NB_ELEM; cpt++) {
sprintf(buf, "%d", cpt);
"The retrieved value is not the same than the injected one (%s!=%s)",
buf, s2);
free(s2);
}
}