comp.lang.ada
 help / color / mirror / Atom feed
* Rep specs
@ 1999-05-31  0:00 Eddy Raineri
  1999-05-31  0:00 ` Robert Dewar
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Eddy Raineri @ 1999-05-31  0:00 UTC (permalink / raw)


Hello,
I have a question regarding rep specs.  There is an individual I work with
that has stated that rep specs are not required by the LRM and as I qoute
"DO NOT USE ADA REP SPECS except in the simplest of cases, or unless you are
sure that the code will NEVER be ported to a different machine or compiler
(hah!)"

I had a totally different opinion.  So I have the following questions.

1)  I was under the impression that it was.  It is in chapter 13 and not an
annex.  Is it required?
2)  I was also thought that using rep specs is ideal for dealing with
porting issues and cross platform communications.  I.E. if a 32 bit PC was
talking to an 8 bit microcontroller via a serial line.  Is this correct?
3)  I also thought that by using rep specs you may not be optimizing the
code correctly for the platform but you are assuring that it will port
correctly to another compiler/platform without any heartburn.
4) I also beleived that using pragm pack and rep spec will allow you to
correctly access hardware registers correctly without using complex bit
manipulation techniques or extra code.


Thanks in advance for you help
E. Raineri






^ permalink raw reply	[flat|nested] 11+ messages in thread
* Rep Specs
@ 1996-10-07  0:00 Doug Shipler
  1996-10-08  0:00 ` Stephen Leake
  0 siblings, 1 reply; 11+ messages in thread
From: Doug Shipler @ 1996-10-07  0:00 UTC (permalink / raw)



I am using SunAda83 version 1.1k on a SunOS Sparc 5.  I have a record
that is rep speced into 32 bit long words.  One of the words is
split up into several fields, one is a 16 bit integer, and the
others are bit flags.  The interesting part is that when I try to
access one of the bit flags, the compiler fetches the wrong bit, it
gets a bit from the 16 bit integer field.  

In this example, Flag3 accesses a bit inside Value.

for My_Record_Typ use
     record at mod 32;
          Value at 0 * 4 range 16 .. 31;
          Flag1 at 0 * 4 range 15 .. 15;
          Flag2 at 0 * 4 range 13 .. 14;
          Unused1 at 0 * 4 range 10 .. 12;
          Flag3 at 0 * 4 range 9 .. 9;
          Flag4 at 0 * 4 range 8 .. 8;
          Unused2 at 0 * 4 range 4 .. 7;
          OtherVal at 0 * 4 range 0 .. 3;
          ........

Any ideas are greatly appreciated!




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

end of thread, other threads:[~1999-06-04  0:00 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-05-31  0:00 Rep specs Eddy Raineri
1999-05-31  0:00 ` Robert Dewar
1999-06-01  0:00   ` czgrr
1999-06-03  0:00   ` Marin David Condic
1999-06-01  0:00 ` Steve Quinlan
1999-06-02  0:00   ` Robert Dewar
1999-06-03  0:00 ` Samuel T. Harris
1999-06-04  0:00   ` Robert Dewar
  -- strict thread matches above, loose matches on Subject: below --
1996-10-07  0:00 Rep Specs Doug Shipler
1996-10-08  0:00 ` Stephen Leake
1996-10-13  0:00   ` Robert Dewar

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