<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'>
Short answer:<BR>
<BR>
<BR>
Consider:<BR>
void F1(int a) { printf("%p\n", &a); }<BR>
void F2(struct { int b,c;} d) { printf("%p\n", &d); }<BR>
<BR>
<BR>
Longer anser:<BR>
<BR>
<BR>
There is no ABI bug. Really.<BR>
<BR>
<BR>
How parameters are passed does not imply where they must be at all times.<BR>
<BR>
<BR>
C has the same feature set as Modula-3. In general and here specifically.<BR>
You can pass structs by value in C and you can take the address of such a struct.<BR>
<BR>
<BR>
The ABI is never perfectly efficient for all scenarios.<BR>If one could predict that all structed passed by value will have their<BR>
address taken, then a different choice might be made.<BR>
However the reality is that sometimes their address is taken, sometimes not.<BR>
One ABI must be formulated (for interop) that strikes an efficiency balance, and always works.<BR>
<BR>
<BR>
Consider that I can take the address of integers and floats and pointers passed by value!<BR>
Yet they are very very often passed in registers. (see the "short answer").<BR>
<BR>
<BR>
A record is just a smaller or larger collection of integers/floats/pointers.<BR>
<BR>
<BR>
The difference is mainly in the layout of the in-memory location, and<BR>
the possibility of large size.<BR>
<BR>
<BR>
<BR>
- Jay<BR>
<BR> <BR>
> Date: Thu, 2 Sep 2010 09:39:12 -0500<BR>> From: rodney_bates<BR>> To: m3devel<BR>> Subject: Re: [M3devel] a trouble with passing records by value..<BR>> <BR>> Jay K wrote:<BR>> > > Date: Tue, 31 Aug 2010 21:24:07 -0500<BR>> > > From: rodney_bates@<BR>> > ><BR>> > > If the writers of an ABI actually *required* that small <BR>> > structs/records be<BR>> > > passed in registers<BR>> > <BR>> > <BR>> > Yes, they have. The rules are hard for me to understand. It isn't just <BR>> > based on size.<BR>> > <BR>> > <BR>> > > then they have made a big blunder.<BR>> > <BR>> > <BR>> > No they have not. They know what they are doing.<BR>> <BR>> When the ABI requires a compiler to do it wrong for the language semantics,<BR>> which it must then compensate for at a place that's outside the jurisdiction<BR>> of the ABI, the ABI has a design bug. At least when the language in question<BR>> is one of those the ABI designers considered, which has to be the case<BR>> with C.<BR> </body>
</html>