From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ab43ecf7e1a10743,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!not-for-mail From: "Nick Roberts" Newsgroups: comp.lang.ada Subject: Zero_Fill pragma Date: Tue, 20 Jul 2004 17:22:27 +0100 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de woEv6oE6XzKbEZNnWaPHRwLZTJfXF9lubqUrgbYQpu+6OCjV4= User-Agent: Opera M2/7.51 (Win32, build 3798) Xref: g2news1.google.com comp.lang.ada:2279 Date: 2004-07-20T17:22:27+01:00 List-Id: Am I too late to make a proposal for a new pragma for the Ada 2005 Amendment? It would have the syntax: pragma Zero_Fill(simple_name); It would be applicable to an object or a subtype, and it would operate on all objects of the given subtype, or on the given object. The object must be of a composite type. It would have the effect of causing all the bits in the object which are unused to have a default initialisation of 0. I think the definition of 'in the object' would be any bit numbered 0 to n-1, where n is the object's size (as the Size attribute would report). I think the definition of 'unused' would be any bit which is not in any of the object's components. If the place of the component is defined by a record representation clause, that will define the bits used by the component, otherwise the bits used by a component will be chosen by the compiler. For records, the effect can be achieved by introducing 'dummy' components, but this is a pain and can degrade readability. For arrays, the effect cannot be achieved by standard means (other than perhaps adding components to the array's component subtype, if it is a record subtype, to bulk the record up to the size of an integral number of allocation units, and then using pragma Pack). Either way, I think the pragma would be useful in real programs, and that it would be useful for the pragma to be defined by the language standard. I'm a little surprised existing compilers don't provide something like this. -- Nick Roberts