Boost logo

Boost :

Subject: Re: [boost] [coroutine] interface suggestion
From: Oliver Kowalke (oliver.kowalke_at_[hidden])
Date: 2012-09-20 07:45:08


> references are not pointers the c++ . They are aliases; there might or
> might not be an address somewhere in memory representing the reference,
> depending on compiler version, optimization level and calling convention.
> In the sniped below, for example, on a modern calling convention, x will
> be
> passed via a register. You can't maningfully get the address of a
> register.
> The register might be spilled on the stack when needed, but the stack slot
> location need not be stable and the compiler may assume that the content
> won't be changed by the user code.

my information was that references are pointers but because they are not changeable after initialization the compiler can do arbitrary things with it (especially the optimizer).
OK - the code could cause undefined behaviour for references.

Should bind() deny to bind to references and the coroutine-fn parameters must be pointers in this case?

Should yield() return a tuple<> instead (as in the current implementation) and bind() is not provided?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk