Albert van der Horst wrote:
> In article <2008Mar9.115712@[EMAIL PROTECTED]
>,
> Anton Ertl <anton@[EMAIL PROTECTED]
> wrote:
>> Krishna Myneni <krishnamyneni@[EMAIL PROTECTED]
> writes:
>>> OFF THIS TOPIC: it would be nice if Forth 200x would standardize a
keyword for
>>> denoting inline words, e.g.
>>>
>>> : CELL- [ 1 CELLS ] LITERAL - ; inline
>>>
>>> A Forth implementation could choose to ignore the keyword, or to give
the marked
>>> word appropriate compile time behavior.
>> If you think it's worth the effort, go ahead and make an RfD. This
>> one should not be too controversial. I am sure you will find a
>> committee member willing to help you when you need help.
>
> What would it mean? An optimizing compiler inlines that code
> anyway. In my embedded renesas Forth I would just do : INLINE ;
> and get over it.
>
The word INLINE gives control to the programmer, rather than the compiler,
on
forcing the word to be used inline. An optimizing compiler may or may not
inline
the word, perhaps depending on optimization level (as with gcc). Allowing
the
programmer to override the optimizer is a useful feature.
> It reminds me of the ``register'' keyword in C. If you have a
non-optimising
> compiler it is ignored. If you have a smart optimising compiler it is
ignored.
> If you have a dumb optimising compiler you force it to do non-optimal
> optimising.
>
This is the reason why the "volatile" keyword exists in C. It forces the
optimizing compiler to reload a variable from memory, rather than keep it
in a
register always. Again, it's an issue of programmer control vs blindly
using the
compiler's optimizations. Anyone who has ever written an interrupt service
routine realizes the need for such control.
>> - anton
>
> Groetjes Albert
>
> --
Krishna


|