[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [mpi-21] MPI::BOTTOM



On Nov 27, 2007, at 5:40 PM, Dave Goodell wrote:

"const TYPE * FOO" indicates that the data pointed to by FOO is read- only. So "*FOO = BAR;" would be an illegal statement.

"TYPE * const FOO" indicates that the memory holding the value of FOO is read-only. So "FOO = &BAR;" would be an illegal statement.

The latter seems to be what is desired for MPI::BOTTOM: an address that cannot be changed but a the data that it references can.


Good point. I think you're right -- I ran a few tests to convince myself that changing the type of MPI::BOTTOM to (void * const) won't break anything in terms of the other existing bindings.

However, in terms of what MPI::BOTTOM *should* be, shouldn't it be *both* consts? We don't want the value to change, nor do we want the pointed-to- contents where it points to change:

    extern const void * const BOTTOM;

Technically, though, with your suggestion, you couldn't change the pointed-to contents without casting anyway (because you can't assign to *(void*)). So this might be a good enough solution.

--
Jeff Squyres
Cisco Systems