Section External, methods being optimized out
Mildred Ki'Lya
ml.mildred593 at gmail.com
Tue Aug 25 16:48:52 UTC 2009
On 08/25/2009 05:46 PM, Jeremy Cowgar wrote:
> Now, thinking about this... Maybe the answer is simple? Why not just
> output *all* slots in the External section? The resulting .c file will
> be a bit larger, however, the C compiler will optimize out a function
> that is not used anyway, so the resulting executable will be no
> different.
>
This is the right thing to do in my opinion. If we created and External
slot, it was to use ut somewhere. We can't throw them away.
Now, I also have an idea that could replace External slots sometimes:
When blocks are present in externals, just create a function for the
block and put the function pointer in the C code. For example:
+ blc :{INTEGER;INTEGER};
blc := { i:INTEGER; i};
`use_callback(@blc)`;
would translate in C:
typedef int (blc_ptr_t*)(int)
void use_callback(blc_ptr_t);
int blc(int i) {
return i;
}
use_callback(blc);
--
Mildred Ki'Lya
╭───────── mildred593@online.fr ──────────
│ Jabber, GoogleTalk: <mildred at jabber.fr>
│ Website: <http://ki.lya.online.fr> GPG ID: 9A7D 2E2B
│ Fingerprint: 197C A7E6 645B 4299 6D37 684B 6F9D A8D6 9A7D 2E2B
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/lisaac-devel/attachments/20090825/01f56ddc/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/lisaac-devel/attachments/20090825/01f56ddc/attachment.pgp>
More information about the Lisaac-devel
mailing list