Re: [dev] Suckless remote shell?

From: Szabolcs Nagy <nsz_AT_port70.net>
Date: Fri, 8 Nov 2013 01:26:31 +0100

* Alexander S. <alex0player_AT_gmail.com> [2013-11-08 02:10:49 +0400]:
> 2013/11/7 Szabolcs Nagy <nsz_AT_port70.net>:
> > with a single pointer arg this assumes that all pointers have
> > the same representation or that you create a separate version
> > of pthread_create for every type used
> Pthread_create doesn't need to know anything about the type of the
> pointer! In fact, nobody except the typechecker needs to.

if different pointers have different representations
then the caller needs to know that at runtime to pass
the argument to the callback

> Runtime information is only needed if you are going to actually
> introspect that arbitrary number of args. If you are going to plop
> them back onto the stack, the only thing you need to know is a total
> size, which can be calculated in compile time.

that's not how the function call abi works

and what you describe can be done now in c without the syntax:
allocate a char array on the stack serialize everything into it,
and pass the pointer and size

you don't get typesafety, but that cannot be done in general
accross a serialize/deserialize step, you could only type
check a few special case of that at best.. by making things
more complicated

> expansion C varargs undergo. But, I suppose, asking that all arguments
> be either floating-point or pointer-size isn't asking too much. It is
> doable.

the size is not all

there are function pointers, structures with alignment requirements,
paddings and bitfields, some implementations support more than three
different floating-point types..

in the end you either have runtime type information to be able to
unpack the arguments and construct calls with them or you have what
c has now
Received on Fri Nov 08 2013 - 01:26:31 CET

This archive was generated by hypermail 2.3.0 : Fri Nov 08 2013 - 01:36:06 CET