Re: C++ in kernel (was Re: exception in a device driver)

Alexander Viro (viro@math.psu.edu)
Sat, 16 Jan 1999 02:35:02 -0500 (EST)


On Sat, 16 Jan 1999, Chip Salzenberg wrote:

> According to Alexander Viro:
> > And if you'll call something that will throw an exception here it
> > will compile to?
>
> That's target-environment-dependent. The ELF object format provides
> enough structure to assist in automatic cleanups; other environments
> require cleanups to be done in ways more like hand-written C.
>
> BTW, there are many places where you
> > * release the lock on different pathes.
> > * don't want to hold it too long.
> > * release it from another function, called by you.
> > * have to release a spinlock before the blocking operation.
> > * have scopes incompatible with syntax ones,
>
> A bit of code rearrangement can be required, yes. TANSTAAFL.

A *what*? Example I gave was pretty typical for fs/inode.c, BTW. Would you
care to show me how to rearrange the code in it so that lexical scopes
would become compatible with the lock-holding ones? I'ld like to see the
results. Moreover, I'ld like to the *code* (for ELF, say it on x86) that
would result of said thing. Preferably with exception-related pieces
marked as such in the listing. Do it for the example you've snipped, OK?

Excuse me, it sounds more and more like an irresponsible handvawing. Could
you show how to do what you want the for the code I gave? Complete with
the resulting assembly, please.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/