home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.c++:16109 comp.std.c++:1538
- Newsgroups: comp.lang.c++,comp.std.c++
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!network.ucsd.edu!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtal
- From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
- Subject: Re: PROPOSAL: Hidden private parts of classes
- Message-ID: <1992Nov11.181520.12692@ucc.su.OZ.AU>
- Sender: news@ucc.su.OZ.AU
- Nntp-Posting-Host: extro.ucc.su.oz.au
- Organization: MAXTAL P/L C/- University Computing Centre, Sydney
- References: <klamer.720538594@mi.el.utwente.nl> <1992Nov7.155248.23401@ucc.su.OZ.AU> <klamer.721303355@mi.el.utwente.nl>
- Date: Wed, 11 Nov 1992 18:15:20 GMT
- Lines: 47
-
- In article <klamer.721303355@mi.el.utwente.nl> klamer@mi.el.utwente.nl (Klamer Schutte) writes:
- >In <1992Nov7.155248.23401@ucc.su.OZ.AU> maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
- >
- >]In article <klamer.720538594@mi.el.utwente.nl> klamer@mi.el.utwente.nl (Klamer Schutte) writes:
- >
- >]>OK, that holds for global / static variables. But how for auto variables?
- >]>These generally are efficient to use, but to be efficient, their size
- >]>must be known at compile time.
- >
- >] Why? Why cant the size be calculated by a smart linker
- >]at link time? Why cant assembly output be made by the compiler
- >]with 'sizeof_someobject' as a symbol yet to be determined?
- >
- >]>and thus can only a pointer to an object on the heap be used.
- >
- >] NO, and I have SEEN it done otherwise in a Modula compiler,
- >]I used it and it worked.
- >
- >I doubt it. I can't see how a compiler can build a stack frame with
- >auto variables, if the sizes of the elements on the stack frame are
- >unknown.
-
- The Modula compiler looks up the last definition of the type
- and uses the size of that. If subsequently the system finds that
- its been changed, auto-dependency checking causes the module
- to be re-compiled.
-
- As I said before this requires environment support to
- work, and is unlikely to be workable for C++ which doesnt have
- the ability to pre-compile a class interface declaration.
- Modula has separate INTERFACE and IMPLEMENTATION sections
- for modules and it is possible to do this. Modula *requires*
- environment support because it has a USE MODULENAME statment,
- whereas C has #include filename. Modula has to associate
- the internal MODULENAME with an external file containing
- the precompiled module interface anyhow.
-
- So thats how it works. It was done deliberately to
- avoid using a pointer on the stack.
-
-
-
- --
- ;----------------------------------------------------------------------
- JOHN (MAX) SKALLER, maxtal@extro.ucc.su.oz.au
- Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
- ;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
-