Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!crdgw1!uunet!meaddata!rob From: rob@meaddata.com (Robert E. Lancia) Newsgroups: comp.lang.c Subject: Re: Info Hiding in C Keywords: Hiding Message-ID: <3997@meaddata.meaddata.com> Date: 18 Apr 91 14:38:32 GMT References: <1991Apr17.004044.22940@ux1.cso.uiuc.edu> <16645@chaph.usc.edu> Sender: usenet@meaddata.com Organization: Mead Data Central, Dayton OH Lines: 41 In article <16645@chaph.usc.edu> jeenglis@alcor.usc.edu (Joe English) writes: >unicorn@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@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@pmserv.meaddata.com | be MDC's. Heck, they | P.O. Box 308 |...!uunet!meaddata!pmserv!rob | may not even be mine. | Dayton, Ohio 45401