comp.lang.ada
 help / color / mirror / Atom feed
* RE: Zero_Fill pragma
@ 2004-07-21  9:24 Lionel.DRAGHI
  0 siblings, 0 replies; 14+ messages in thread
From: Lionel.DRAGHI @ 2004-07-21  9:24 UTC (permalink / raw)
  To: comp.lang.ada



| -----Message d'origine-----
| De: Martin Dowie [mailto:martin.dowie@baesystems.com]
...
| 
| What about hardware/interface specs that require '1' not '0'?.. ;-)
Refer to my proposal :-)



^ permalink raw reply	[flat|nested] 14+ messages in thread
* RE: Zero_Fill pragma
@ 2004-07-21 12:59 Lionel.DRAGHI
  2004-07-21 21:54 ` Marin David Condic
  0 siblings, 1 reply; 14+ messages in thread
From: Lionel.DRAGHI @ 2004-07-21 12:59 UTC (permalink / raw)
  To: comp.lang.ada



| -----Message d'origine-----
| De: Marin David Condic [mailto:nobody@noplace.com]
...
| Isn't there something in the "Safety" annex about initialization of 
| scalars? Can't remember off the top of my head, but I think I bumpped 
| into it at some point. Would that be useful in this context?

Not really : what would be useful here is initialization *between* scalars
;-)

-- 
Lionel Draghi



^ permalink raw reply	[flat|nested] 14+ messages in thread
* RE: Zero_Fill pragma
@ 2004-07-20 17:13 Lionel.DRAGHI
  2004-07-21 12:27 ` Marin David Condic
  0 siblings, 1 reply; 14+ messages in thread
From: Lionel.DRAGHI @ 2004-07-20 17:13 UTC (permalink / raw)
  To: comp.lang.ada



| -----Message d'origine-----
| De: Nick Roberts [mailto:nick.roberts@acm.org]
...
| 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 have the effect of causing all the bits in the
| object which are unused to have a default initialisation
| of 0.

I agree, this would be of immediate use here.

-- 
Lionel Draghi         http://webshop.ffii.org/



^ permalink raw reply	[flat|nested] 14+ messages in thread
* Zero_Fill pragma
@ 2004-07-20 16:22 Nick Roberts
  2004-07-20 17:37 ` Jean-Pierre Rosen
  2004-07-20 21:57 ` Frank
  0 siblings, 2 replies; 14+ messages in thread
From: Nick Roberts @ 2004-07-20 16:22 UTC (permalink / raw)


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



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2004-07-22  9:02 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-21  9:24 Zero_Fill pragma Lionel.DRAGHI
  -- strict thread matches above, loose matches on Subject: below --
2004-07-21 12:59 Lionel.DRAGHI
2004-07-21 21:54 ` Marin David Condic
2004-07-20 17:13 Lionel.DRAGHI
2004-07-21 12:27 ` Marin David Condic
2004-07-22  9:02   ` Dale Stanbrough
2004-07-20 16:22 Nick Roberts
2004-07-20 17:37 ` Jean-Pierre Rosen
2004-07-20 20:14   ` Nick Roberts
2004-07-20 21:06     ` Jacob Sparre Andersen
2004-07-20 22:15     ` Georg Bauhaus
2004-07-21  7:21     ` Jean-Pierre Rosen
2004-07-21  9:00     ` Martin Dowie
2004-07-20 21:57 ` Frank

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox