A library of flux footprint modelling algorithms
- Zhan Li, zhanli AT gfz-potsdam DOT de, zhanli1986 AT gmail DOT com
-
File naming convention
- All lower case letters
- Words separated by underscore "_"
- Use lower cases even a word is an acronym
Example:
landsat_view_geo.c -
Function naming convention
- Start with lower case letters
- Then separate words by capitalizing initial letters
- Use lower cases according to the above rules even a word is an acronym
Example:
openSensorFile (Dis_landsat_t * sensor)-
Variable naming convention
- All lower case letters
- Words separated by underscore "_"
- Use lower cases even a word is an acronym
Example:
double scale_factor;-
Macro, and all the others global variable naming convention
- All upper case letters
- Words separated by underscore "_"
Example:
static const char MOD_GRID_NAME[100] = "MOD_Grid_BRDF";
#define N_SRF_BAND (6)
typedef struct {
Some_type SOME_MEMBER_VARIABLE;
} Dis_landsat_t;-
User-defined type from typedef
- Start the first letter in upper case
- Then all the other letters in lower case
- Separate words by underscore "_"
- Optional: end the type name with "_t" to indicate this is a type name
- Use lower cases according to the above rules even a word is an acronym
Example:
typedef enum
{
MODIS_BRDF = 0,
VIIRS_BRDF
} Brdf_src_t;-
C code indentation
-
Use the style designated by the following options of the command
indentindent -br -ce -bap --no-tabs
Example:
-
for (isc = 0; isc < num_mosaic_scenes; isc++) {
if (0 != parse_usgs_xml (lndSR[isc]->fileName, &(lndSR[isc]->scene))) {
fprintf (stderr, "Parse xml failed. XML=%s\n", lndSR[isc]->fileName);
return FAILURE;
}
}- Tabs or spaces
- Spaces for indentation in code files
- Tabs for indentation in makefile