Path: utzoo!attcan!uunet!microsoft!jimad From: jimad@microsoft.UUCP (Jim ADCOCK) Newsgroups: comp.std.c++ Subject: Re: Packing, Ordering, and Rearranging Message-ID: <57467@microsoft.UUCP> Date: 17 Sep 90 17:36:43 GMT References: <195@xstor.UUCP> <1233@lupine.NCD.COM> <1407@lupine.NCD.COM> <2218@ux.acs.umn.edu> Reply-To: jimad@microsoft.UUCP (Jim ADCOCK) Organization: Microsoft Corp., Redmond WA Lines: 32 In article <2218@ux.acs.umn.edu> hopper@ux.acs.umn.edu (Eric Hopper) writes: | Some people may argue that it is up to the compiler to make your |code efficient. I would kindly direct them to some very nice languages that |do this for you. Pascal, and FORTRAN are good examples. I personally don't |like either of those languages because the compiler may be arbitrarily wrong |(as far as efficiency is concerned), and you don't have enough control over |the produced code to fix it. | | Making the structure packing rules too complex would bring you too |far away from the machine you are programming, and make it impossible to |preform some optimizations yourself. This is not what C, or C++ is about. I think these arguments would be fine if we were still talking about C. But, If one is using inheritence and encapsulation, then significant compiler optimizations are required. One cannot have Bob create a base class, and Diane create a derived class, and give each intimate control of the structure that results. One cannot write portable software, and in general take control of the intimate details of structural layout. Certainly, there are going to be situations where the programmer is going to want to take the bull by the horns, and tell the compiler precisely what the layout should be. Maybe in some situations, the programmer is going to want to use an "asm" directive and lay down some particularly tight, hand written code. But make such fine-grained control the default ??? This would prevent the compiler from customizing the code generated for a given usage, for the unusual case where the programmer needs to take over manual control. The programmer can stil sieze control where necessary, by turning off optimizations, or using pragmas, or whatever. Let the compiler optimize the usual cases, and save the humans to optimize the really special cases.