...
Code Block | ||||
---|---|---|---|---|
| ||||
struct string_mx { size_t size; size_t maxsize; unsigned char strtype; char *cstr; }; typedef struct string_mx string_mx; /* Function declarations */ extern errno_t strcpy_m(string_mx *s1, const string_mx *s2); extern errno_t strcat_m(string_mx *s1, const string_mx *s2); /* etc.And so on */ |
The implementation of the string_mx
type is fully visible to the user of the data type after including the string_m.h
file. Programmers are consequently more likely to directly manipulate the fields within the structure, violating the software engineering principles of information hiding and data encapsulation and increasing the probability of developing incorrect or nonportable code.
...
Code Block | ||||
---|---|---|---|---|
| ||||
struct string_mx; typedef struct string_mx string_mx; /* Function declarations */ extern errno_t strcpy_m(string_mx *s1, const string_mx *s2); extern errno_t strcat_m(string_mx *s1, const string_mx *s2); /* etc. And so on */ |
In the internal header file, struct string_mx
is fully defined but not visible to a user of the data abstraction:
...