From: snir@XXXXXXXXXX X-Lotus-FromDomain: IBMUS To: Nicholas Nevin - Sun HPC High Performance Computing cc: mpi-core@XXXXXXXXXXX Date: Thu, 25 Mar 1999 18:22:37 -0500 Subject: Re: clarification on inter-language interoperability of attributes Mime-Version: 1.0 Content-type: text/plain; charset=us-ascii Content-Disposition: inline Sender: owner-mpi-core@XXXXXXXXXXX Precedence: bulk X-UIDL: c27901b6b8a45a5f47041569645dde43 It's a bad idea to store and retrieve integer attributes in C -- since C stores and retrieves attributes of type void* (pointers). You can either 1. Trust type coertion to work OK. I.e. int ub; void* tagub; MPI_Comm_put_attr(..., (void*)ub,...); MPI_Comm_get_attr(..., &tagub, ...); ub = (int)tagub; this code, of course, is not portable. 2. Allocate memory for the integer attribute, and cache a pointer to the allocated memory. int ub; int *tagub tagub = (*int)malloc(sizeof ub); *tagub = ub; MPI_Comm_put_attr(..., tagub,...); MPI_Comm_get_attr(..., &tagub,...); ub = *tagub; Marc Snir Senior Manager, Scalable Parallel Systems IBM T J Watson Research Center, PO Box 218, Yorktown Heights 10598 Tel: 914 945 3204 (862 3204) Fax: 914 945 4425 (862 44245) URL: http://www.research.ibm.com/people/s/snir