TODO:
- write converting functions for analog filters - partially DONE
- write units conversions
- write filtering function for IRRs, write FIR create function
- write freq/phase functions for analog and digital - partially DONE
- write comparison tests for them - DONE
- write DIRECT forms
- write code for discretization
- Choose names that clearly describe the purpose or role of the variable, function, or type.
- Example: Use
buffer_size
instead ofbs
,calculate_area()
instead ofca()
.
- Use
snake_case
for variable names. - Keep the names concise but descriptive.
- Example:
int buffer_length;
,char file_name[256];
- Use
snake_case
for function names. - Start function names with a verb to indicate action.
- Example:
read_file()
,calculate_sum()
- Use
UPPER_CASE
with underscores for constants and macros. - Example:
#define MAX_BUFFER_SIZE 1024
,const int DEFAULT_TIMEOUT = 30;
- Use
PascalCase
(also calledCamelCase
with an initial uppercase letter) fortypedef
names, structs, and enums. - Example:
typedef struct FileHeader FileHeader;
,enum Color { Red, Green, Blue };
- Use consistent prefixes to group related functions and variables, especially in large codebases or libraries.
- Example:
file_read()
,file_write()
,file_close()
(all related to file operations).
- Avoid prefixing variable names with type information (
iCount
,strName
). This is less common in modern C practice. - Instead, rely on meaningful names and comments to clarify usage.
- Avoid unnecessary abbreviations. If you must use them, ensure they are widely understood.
- Example:
calculate_average()
is better thancalc_avg()
unless the context is very clear.
- Use a prefix (often related to the module or context) for global variables to avoid name collisions.
- Example:
g_config_file_path
,app_error_code
- Use consistent naming for error codes and handling functions.
- Example:
int open_file();
,int close_file();
,return FILE_ERROR_OPEN_FAILED;