|
Funny enough, I read an article yesterday that talks about c programmer
should try to avoid using typedef.
The reason that I use typedef is because the moduleName and locationID
should actually be a fix 10 char long variables. The logMessage should
actually be a varying length field of 2048 char long. So, to force all
caller to obey this rule, I used typedef and this was what it looked
like originally:
typedef struct {
char value[10];
} logECD_STP3_piModuleName_T;
typedef struct {
char value[32766];
} logECD_STP3_piLocationID_T;
typedef struct {
unsigned short l;
char a[2048];
} logECD_STP3_piLogMessage_T
But I soon found out that c doesn't allow passing literal to a char
array parameter (<= Not programmer friendly).
So I change it to use char * and left the typedef (lazy me).
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.