Info Hiding in C
Robert E. Lancia
rob at meaddata.com
Fri Apr 19 00:38:32 AEST 1991
In article <16645 at chaph.usc.edu> jeenglis at alcor.usc.edu (Joe English) writes:
>unicorn at uxh.cso.uiuc.edu (Harry E Miller) writes:
>
>>I wish to include optional information hiding within this library,
>>so that the programer can only get string information from a
>>function (not a macro!).
>> [...]
> [...]
>struct _string {
> ... /* same as above */
>};
>
>typedef char String[sizeof(struct _string)];
>
>and it will work on any platform/compiler/memory model.
> [...]
>--Joe English
> jeenglis at alcor.usc.edu
This won't work because if you check the original article, you'll
see that his #ifdef's hide the struct _string.
#ifdef INFO_HIDING
typedef char String[???];
#else
typedef struct _string {
...
} String;
#endif
When the compiler needs to know the array size, the struct _string isn't
visable.
--
|Robert Lancia | The above opinions | Mead Data Central
|(513) 297-2560 | may not necessarily | Data Services Division
|rob at pmserv.meaddata.com | be MDC's. Heck, they | P.O. Box 308
|...!uunet!meaddata!pmserv!rob | may not even be mine. | Dayton, Ohio 45401
More information about the Comp.lang.c
mailing list