Re: [C--] First C-- code from Algol 68
Hendrik Boom <[email protected]> Thu, 8 Jan 2009 15:39:37 +0000 (UTC)
| Newsgroups | gmane.comp.lang.c-- |
|---|---|
| Message-ID | <[email protected]> |
On Mon, 15 Dec 2008 21:30:14 -0500, Norman Ramsey wrote:
> You can 'export H as main' but you will need to give it the C calling
> convention for both the procedure definition and the return. Here's an
> example from our test suite:
>
> foreign "C" main(bits32 argc, "address" bits32 argv) {
> bits32 x, y;
> bits32 n, m;
> n, m = 987, 33;
> x, y = divmod(n, m);
>
> foreign "C" printf("address" answer, n, m, x, n, m, y, x * m + y);
> foreign "C" return(0);
> }
>
> Norman
Thanks for the example. I've looked at the test suite now for more
examples.
I stuck some printf's into my generated object code by hand, and my code
seems to be doing the right calculations.
-- hendrik
_______________________________________________
Cminusminus mailing list
[email protected]
https://cminusminus.org/mailman/listinfo/cminusminus