2009/3/6 Andy Wingo <wi...@pobox.com>:
> Hi Linas,
>
> On Thu 05 Mar 2009 22:56, Linas Vepstas <linasveps...@gmail.com> writes:
>
>> Perhaps I'm naive, perhaps some naming convention
>> could be used to  indicate that SCM_OUT_OF_RANGE
>> will never return?  None of the functions in the call stack
>> gave any real hint that they might now return; they mostly
>> looked liked ordinary functions.
>
> Changing the names would be quite an undertaking. Perhaps we should be
> more clear about this point in the docs, though, as it is fundamental to
> Guile programming in C.

The Linux kernel uses the gcc markup
__attribute__((noreturn))

to indicate a function that does not return; so e.g.

void blahfunc(SCM args) __attribute__((noreturn));

It used to be common to see
#define NORET __attribute__((noreturn))
and
void NORET blafunc(...);
put that style passed on ...

I have no clue what the compiler does with this.
perhaps it handles the stack differently, knowing
its never unwound, or maybe it doesn't generate
the function epilogue.

Even if the compiler does nothing, it would still be
a handy clue to the programmer reading the code!

--linas

/usr/src/linux-2.6.28.4# grep -r noreturn * |wc
     92     439    7488


Reply via email to