# ATSinline()

**URL:** <https://discourse.ats-lang.org/t/atsinline/319>\
**Category:** Google Group\
**Created:** [October 8, 2015, 3:32am UTC](https://discourse.ats-lang.org/t/atsinline/319 "2015-10-08T03:32:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gmhwxi](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gmhwxi](https://discourse.ats-lang.org/u/gmhwxi)\
**Post date:** [October 8, 2015, 3:32am UTC](https://discourse.ats-lang.org/t/atsinline/319/1 "2015-10-08T03:32:11Z")

</div>

You can now use  
_ATS\_EXTERN\_DEF_ to define ATSextern():

#ifndef   
_ATS\_EXTERN\_DEF_  
#define ATSextern() extern  
#else  
#define ATSextern() _ATS\_EXTERN\_DEF_  
#endif // #ifndef

See:

> <https://github.com/githwxi/ATS-Postiats/blob/master/ccomp/runtime/pats_ccomp_basics.h>

ATSstatic and ATSinline can be defined similarly.On Wednesday, October 7, 2015 at 4:44:51 PM UTC-4, Barry Schwartz wrote:

> Given that, in another thread, the topic of helping the C compiler do  
> inlining showed up: is there a nice way to add stuff to ATSinline()?
> 
> I have to prepend stuff to the C code I generate, anyway, so what I’m  
> doing is this:
> 
> #if defined **GNUC** && !defined inline  
> /\* Cause ATS-generated code to be inlined wherever possible. \*/  
> #define inline **inline**  **attribute** (( **always\_inline** ))  
> #endif
> 
> But I was curious if there was a nice way to do it if one is not using  
> ATS to make C code that then gets processed some more.
> 
> Similarly, is there a way to put something like  
> **attribute** (( **flatten** )) in ATSextern() or ATSstatic()?

---

<div class="post-metadata">

**Author:** ![gmhwxi](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gmhwxi](https://discourse.ats-lang.org/u/gmhwxi)\
**Post date:** [October 9, 2015, 12:52am UTC](https://discourse.ats-lang.org/t/atsinline/319/2 "2015-10-09T00:52:17Z")

</div>

Okay. I will use **ATS…** instead.On Thursday, October 8, 2015 at 3:23:39 PM UTC-4, Barry Schwartz wrote:

> gmhwxi \<[gmh...@gmail.com](mailto:gmh...@gmail.com) \<javascript:\>\> skribis:
> 
> > You can now use  
> > _ATS\_EXTERN\_DEF_ to define ATSextern():
> 
> There is one remark I just realized I ought to make, which is that (as  
> I only recently came upon in the C standard) names beginning with ‘\_’  
> followed by a capital letter are supposed to be reserved for the  
> compiler.
> 
> The same with names that begin with two underscores, ‘\_\_’, followed by  
> a lowercase letter.
> 
> It is not uncommon to find ‘violations’ of this provision that no one  
> is ever going to do anything about, such as some of the names in GMP,  
> and a compiler that complained would be obnoxious. Nevertheless, I  
> have started being conscious of the ‘rule’ in my own coding. 🙂  
> Started using more postfix ‘\_’ characters and fewer prefix ones.

---

<div class="post-metadata">

**Author:** ![gmhwxi](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gmhwxi](https://discourse.ats-lang.org/u/gmhwxi)\
**Post date:** [October 9, 2015, 1:40am UTC](https://discourse.ats-lang.org/t/atsinline/319/3 "2015-10-09T01:40:57Z")

</div>

I see. I will drop the two underscores in the front.On Wednesday, October 7, 2015 at 4:44:51 PM UTC-4, Barry Schwartz wrote:

> Given that, in another thread, the topic of helping the C compiler do  
> inlining showed up: is there a nice way to add stuff to ATSinline()?
> 
> I have to prepend stuff to the C code I generate, anyway, so what I’m  
> doing is this:
> 
> #if defined **GNUC** && !defined inline  
> /\* Cause ATS-generated code to be inlined wherever possible. \*/  
> #define inline **inline**  **attribute** (( **always\_inline** ))  
> #endif
> 
> But I was curious if there was a nice way to do it if one is not using  
> ATS to make C code that then gets processed some more.
> 
> Similarly, is there a way to put something like  
> **attribute** (( **flatten** )) in ATSextern() or ATSstatic()?
