Inline in ATS

Is there a way or desire to have a function in ATS generate an inline C
function declaration?

Something like the following could possibly act as both a hint and a way to
export the function to C:

externfun myfun (…): int = “inline#myfun_in_c”

Maybe most compilers are already good enough at spotting functions to be
inlined that this isn’t very helpful for function calls in loops.

I did not try -fwhole-program. I tried a flag of the name ‘-compile’ (?);
it worked but the flag
was moved from the recent versions of gcc.

There is another reason for me to use ATS to generate a single C file
containing everything.
I could use TinyCC (TCC) to compile such a file. Due to the speed of TCC,
it is a bit like using
the C code as some kind of script.On Wed, Oct 15, 2014 at 9:44 PM, Barry Schwartz < chemoe...@chemoelectric.org> wrote:

gmhwxi gmh...@gmail.com skribis:

I often combine all the files in a program into one (by using #include
and
some other features of ATS) to allow the C compiler to “churn” it :slight_smile:

Would -fwhole-program also work?

(The #include et al approach should work as long as -funit-at-a-time
is active.)


You received this message because you are subscribed to the Google Groups
“ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/20141016014421.GB26540%40crud
.

I would just leave it to the compiler.

The important thing is to facilitate inlining. For instance, using
templates
or putting code in a CATS-file can make sure that the functions to be
inlined
stay in the same compilation unit where they are called.

I often combine all the files in a program into one (by using #include and
some other features of ATS) to allow the C compiler to “churn” it :slight_smile:

The code in ATSLIB/prelude and ATSLIB/libats consists of mostly templates.
So most ATSLIB-functions get “churned” as well.On Wednesday, October 15, 2014 4:47:20 PM UTC-4, Brandon Barker wrote:

Is there a way or desire to have a function in ATS generate an inline C
function declaration?

Something like the following could possibly act as both a hint and a way
to export the function to C:

externfun myfun (…): int = “inline#myfun_in_c”

Maybe most compilers are already good enough at spotting functions to be
inlined that this isn’t very helpful for function calls in loops.