Modern theoretical astrophysics relies heavily on the utilization of simulations to model astrophysical processes which take place on enormous timescales. The people who write the simulations are held in high esteem by the community at large. The code contained in them.... well, see for yourself. (anonymized to protect the criminally stupid)
file_stuff.c
#include "globals.h"
void set_labels(void) {
enum field_names i;
for (i = 0; i < NUM_FIELD_NAMES; i++)
switch (i) {
case FIELD_1:
strncpy(labels[FIELD_1], "AAA ", 4);
break;
case FIELD_2:
strncpy(labels[FIELD_2], "BBB ", 4);
break;
case FIELD_3:
strncpy(labels[FIELD_3], "CC ", 4);
break;
case FIELD_4:
strncpy(labels[FIELD_4], "DDDD", 4);
break;
case FIELD_5:
strncpy(labels[FIELD_5], "E ", 4);
break;
case FIELD_6:
strncpy(labels[FIELD_6], "FFF ", 4);
break;
case FIELD_7:
strncpy(labels[FIELD_7], "GGGG", 4);
break;
case FIELD_8:
strncpy(labels[FIELD_8], "HHH ", 4);
break;
case FIELD_9:
strncpy(labels[FIELD_9], "III", 4);
break;
case FIELD_10:
strncpy(labels[FIELD_10], "JJJJ", 4);
break;
case FIELD_11:
strncpy(labels[FIELD_11], "KKKK", 4);
break;
}
}
}
globals.h
typedef enum {FIELD_1, /*snip*/, FIELD11} field_names;
#define NUM_FIELD_NAMES 11
extern char labels[NUM_FIELD_NAMES][4];
globals.c
#include "globals.h"
char labels[NUM_FIELD_NAMES][4]; /* <! This table holds four-byte character tags used for file output */
Given this setup, you might assume that labels is used throughout the program. It is used exactly once -- where set_labels() is called.
I can't help but think that the person who wrote this (a most esteemed theoretical astrophysicist) had a thought process that went something like: "I need to populate an array of string literals. I know! I'll use an enum to make it easily accessible! But how do I put them together? I know! I'll use my trusty for-loop!"
And this isn't the worst coding offense I have seen in astronomy software. At least they are using Doxygen comments.