Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For loop initial declarations are only allowed in C99 mode #2517

Merged
merged 1 commit into from
Sep 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions nc_test4/tst_virtual_datasets.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ static void
create_dataset_a() {
hsize_t dims[1] = {VARIABLE_SIZE};
float data[VARIABLE_SIZE];
for(size_t i = 0; i < VARIABLE_SIZE; ++i) {
size_t i;
for(i = 0; i < VARIABLE_SIZE; ++i) {
data[i] = (float)i;
}

Expand Down Expand Up @@ -51,6 +52,7 @@ create_dataset_b() {

int read_back_contents(const char* filename) {
int ncid, varid, ndims;
size_t i;
float data[VARIABLE_SIZE];

char var_name[NC_MAX_NAME+1];
Expand All @@ -63,7 +65,7 @@ int read_back_contents(const char* filename) {
if (nc_inq_var(ncid, varid, var_name, &var_type, &ndims, dimids_var, &natts)) ERR;
if (nc_get_var_float(ncid, varid, data)) ERR;
printf("\t %s: ", var_name);
for (size_t i = 0; i < VARIABLE_SIZE; ++i) {
for (i = 0; i < VARIABLE_SIZE; ++i) {
printf("%f, ", data[i]);
}
printf("\n");
Expand Down