comp.lang.ada
 help / color / mirror / Atom feed
* Apex 4.2 question about records
@ 2002-10-24 22:29 Nelson Chandler
  2002-10-25  2:30 ` Steven Deller
  2002-11-15 21:43 ` Hartmut Schaefer
  0 siblings, 2 replies; 4+ messages in thread
From: Nelson Chandler @ 2002-10-24 22:29 UTC (permalink / raw)


Hi.  I'm using Apex 4.2. When I compile and it reaches a record type, I get
this warning:

"<record name> is passed by copy, but it was passed by reference in releases
prior to Apex 4.2; this may cause incompatibilities"

What does this mean and why is it telling me.  It seems like record types
would be fairly common and its extreemly annoying getting this message all
the time.

Thanks,
Nelson





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

* RE: Apex 4.2 question about records
  2002-10-24 22:29 Apex 4.2 question about records Nelson Chandler
@ 2002-10-25  2:30 ` Steven Deller
  2002-11-15 21:43 ` Hartmut Schaefer
  1 sibling, 0 replies; 4+ messages in thread
From: Steven Deller @ 2002-10-25  2:30 UTC (permalink / raw)


Nelson,
Yes, I agree that having it all the time is annoying.  I have sent an
independent "complaint" to Rational.  I suggest you do the same.
Normally when a particular compiler is doing something strange, it is
probably best to contact their customer support.  I'm sure Rational's
support would tell you the same thing I describe below (it actually is
just a summary from the Apex 4.2 release notes).

What the message is is saying it quite clear if you read it carefully.
There are record types (up to 3 scalars) that are now passed efficiently
in registers (by value) rather than in memory with a pointer (by
reference).  Properly written programs won't care, but it is not
uncommon for customers to write code that depends on the "by reference"
implementation.  Since Ada leaves the passing mechanism for records
unspecified (specifically to allow such optimizations), those programs
are erroneous.

The message is Rational being over-protective of their customers.
Unfortunately, this is one case where there are so many false positives,
that the message gets tuned out anyway.  I suggested they add a switch
that would turn off this warning if users wanted (without turning off
other warnings).

By the way, the optimization makes things like complex arithmetic
extremely fast, even without inlining.  That was the primary reason for
Rational adding this particular optimization.

Note -- I am not a Rational employee but was for many years.  I know
about this particular issue because it is showing up in an upgrade to
Apex 4.2 that I am helping with at a customer site.

Regards,
Steve

> -----Original Message-----
> From: comp.lang.ada-admin@ada.eu.org 
> [mailto:comp.lang.ada-admin@ada.eu.org] On Behalf Of Nelson Chandler
> Sent: Thursday, October 24, 2002 6:30 PM
> To: comp.lang.ada@ada.eu.org
> Subject: Apex 4.2 question about records
> 
> Hi.  I'm using Apex 4.2. When I compile and it reaches a 
> record type, I get this warning:
> 
> "<record name> is passed by copy, but it was passed by 
> reference in releases prior to Apex 4.2; this may cause 
> incompatibilities"
> 
> What does this mean and why is it telling me.  It seems like 
> record types would be fairly common and its extreemly 
> annoying getting this message all the time.
> 
> Thanks,
> Nelson
> 
> 
> _______________________________________________
> comp.lang.ada mailing list
> comp.lang.ada@ada.eu.org 
> http://ada.eu.org/mailman/listinfo/comp.lang.ad> a
> 




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

* Re: Apex 4.2 question about records
  2002-10-24 22:29 Apex 4.2 question about records Nelson Chandler
  2002-10-25  2:30 ` Steven Deller
@ 2002-11-15 21:43 ` Hartmut Schaefer
  2002-11-17 23:04   ` Greg Bek
  1 sibling, 1 reply; 4+ messages in thread
From: Hartmut Schaefer @ 2002-11-15 21:43 UTC (permalink / raw)


Nelson,

you can turn this warnings off  by the new "pragma suppress_warnings". This
pragma turns off the warning on a per type basis. There is no "global" way,
e.g. per view or per unit. I must admit that this might be laboringly.

There are also 2 implementation defined parameters of pragma Convention
dealing with the method how parameters are passed: Ada_Pass_By_Copy and
Ada_Pass_By_Reference.

Please have a look into the 4.2 release notes for a detailed description of
these new features. If you have further questions or comments don't hesitate
to contact our support.

  Hartmut Schaefer
    Rational Software Germany

dealing with the pass method of parameters: pragma
"Nelson Chandler" <nelson.c.chandler@boeing.com> schrieb im Newsbeitrag
news:H4IBt8.KM5@news.boeing.com...
> Hi.  I'm using Apex 4.2. When I compile and it reaches a record type, I
get
> this warning:
>
> "<record name> is passed by copy, but it was passed by reference in
releases
> prior to Apex 4.2; this may cause incompatibilities"
>
> What does this mean and why is it telling me.  It seems like record types
> would be fairly common and its extreemly annoying getting this message all
> the time.
>
> Thanks,
> Nelson
>
>





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

* Re: Apex 4.2 question about records
  2002-11-15 21:43 ` Hartmut Schaefer
@ 2002-11-17 23:04   ` Greg Bek
  0 siblings, 0 replies; 4+ messages in thread
From: Greg Bek @ 2002-11-17 23:04 UTC (permalink / raw)


Nelson,
You also asked what did the message mean.

In earlier releases of Apex it was usual to pass structured types by
reference, this meant
that the address of the actual data was passed to the called routine.  In
many instances
this was inefficient as temporary data had to be copied to memory, an
address to that
memory was then passed to the called routine which then used that address to
fetch
the data from memory.  The nett result was a number of data moves to/from
memory
that are wasteful of time.

In Apex 4.2 the compiler will recognise a class of data types (see the
release note for
details) that no longer need to be stored in memory, but will instead be
stored in machine
registers (probably where the values are already).  This way the called
subprogram doesn't
have to retrieve the data from memory.  This results in a significant time
saving.

Probably the best example would be a complex number type that is defined as
a record
with two floating point components.  With Apex 4.2 the components are passed
in
registers, which usually results in a significant speed up of applications
relying heavilly
upon these types.

The warning is there because it is possible that people have written code
that assumes
values of these types are passed as references and try to use them as such.
A good
example would be someone using packaing Machine_Code that accesses these
parameters.

Pragma Suppress_Warning can be used to supress the message.  Once again
refer to
the release note.

Greg Bek
Rational Software
"Hartmut Schaefer" <HSchaefer@rational.com> wrote in message
news:xUdB9.436993$DB1.4976953@news.easynews.com...
> Nelson,
>
> you can turn this warnings off  by the new "pragma suppress_warnings".
This
> pragma turns off the warning on a per type basis. There is no "global"
way,
> e.g. per view or per unit. I must admit that this might be laboringly.
>
> There are also 2 implementation defined parameters of pragma Convention
> dealing with the method how parameters are passed: Ada_Pass_By_Copy and
> Ada_Pass_By_Reference.
>
> Please have a look into the 4.2 release notes for a detailed description
of
> these new features. If you have further questions or comments don't
hesitate
> to contact our support.
>
>   Hartmut Schaefer
>     Rational Software Germany
>
> dealing with the pass method of parameters: pragma
> "Nelson Chandler" <nelson.c.chandler@boeing.com> schrieb im Newsbeitrag
> news:H4IBt8.KM5@news.boeing.com...
> > Hi.  I'm using Apex 4.2. When I compile and it reaches a record type, I
> get
> > this warning:
> >
> > "<record name> is passed by copy, but it was passed by reference in
> releases
> > prior to Apex 4.2; this may cause incompatibilities"
> >
> > What does this mean and why is it telling me.  It seems like record
types
> > would be fairly common and its extreemly annoying getting this message
all
> > the time.
> >
> > Thanks,
> > Nelson
> >
> >
>
>





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

end of thread, other threads:[~2002-11-17 23:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-24 22:29 Apex 4.2 question about records Nelson Chandler
2002-10-25  2:30 ` Steven Deller
2002-11-15 21:43 ` Hartmut Schaefer
2002-11-17 23:04   ` Greg Bek

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