Hello everyone, I would like to discuss about C99 standard and how we code it.
I didn't realize I was coding in C++ 90% of the time when I was trying to do C language in the API support. So, the first thing I want to discuss first is how we do a "class" like in struct.
Code:
typedef struct {
void (*SetFunction1)(int, int);
} Class_Struct1;
void Class_Struct1_Set_Function1(int value1, int value2) {
//Do stuff here
}
void execFunction() {
int value1 = 1;
int value2 = 2;
Class_Struct1 cs1 = { Class_Struct1_Set_Function1 };
cs1.SetFunction1(value1, value2);
}
Now the question is... in what way do programmer standardize this struct class-like and the function names? Is it like...
Code:
//Struct function
void (*class_get_set_function)(...);
//"member" function
void class_get_set_function(...) {
}
or (This is what I think, except minor issue with certain unique function names.)
Code:
//Struct function
void (*get_set_function)(...);
//"member" function
void class_get_set_function(...) {
}
or...? I'm having difficulty to determine the standardize method for this. What I do know is they are lowercase plus each word has an underline in-between. I'll be graceful for your inputs.
P.S. I'm unable to use such as "get_data" in a struct's function pointer due to another name is already redefined in SQL header file.
Keywords for C99 support:
Code:
auto
break
case
char
const
continue
default
do
double
else
enum
extern
float
for
goto
if
inline
int
long
register
restrict
return
short
signed
sizeof
static
struct
switch
typedef
union
unsigned
void
volatile
while
_Bool
_Complex
Imaginary
Bookmarks