toddf@petsd.UUCP (Todd Feldman) (08/12/87)
Can anyone tell me what's wrong with this Ada structure? TYPE rec IS RECORD s : STRING(1..5); c : CHARACTER; END RECORD; FOR rec USE RECORD AT MOD 4; s at 0 range 1..40; c at 0 range 42..49; END RECORD; I am getting a RESTRICTION from the compiler saying that s cannot be mapped according to the representation I've specified. Thanks a lot! Todd -- Todd J. Feldman Concurrent Computer Corporation I Stanford University Tinton Falls, NJ 07724 I Stanford, CA 94305 ...princeton... I f.fangoria@lear.stanford.edu \ I video@portia.stanford.edu ...rutgers......!petsd!toddf I / I ...moncol...... I
PLOEDEREDER@TL-20B.ARPA (08/13/87)
You have used an exceedingly nasty representation spec, which when obeyed may cause oodles of code for accessing characters in that string. Try using s at 0 range 0..39; instead (or do you really want it offset by 1 bit ??). With the component clause specifing range 1..40 (incidently a very frequent unintentional mis-typing in lieu of the above), each character in the string would cross a byte boundary. Depending on your target machine, you might see as much as half a page of assembly instructions to do "X.S(i)", while with a 'range 0..39' it could be done in 1 or 2 instructions at the most. Of course, if your target machine isn't one of those..... If 's at 0 range 0..39;' doesn't work, start complaining to your vendor. Erhard Ploedereder Tartan Laboratories Inc. (usual disclaimers) -------