X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ad32fd753f73b8a8a14242781eb011e78446995a..39c935d6d5ee86d153f6f7e6a10d723ae7c57f6f:/teshsuite/smpi/type-struct/type-struct.c diff --git a/teshsuite/smpi/type-struct/type-struct.c b/teshsuite/smpi/type-struct/type-struct.c index 835b852413..ec807cbe14 100644 --- a/teshsuite/smpi/type-struct/type-struct.c +++ b/teshsuite/smpi/type-struct/type-struct.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2014. The SimGrid Team. +/* Copyright (c) 2012-2021. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -10,18 +10,23 @@ int main(int argc, char **argv) { int rank; - struct { int a;int c; double b;int tab[2][3];} value; + struct { + int a; + int c; + double b; + int tab[2][3]; + } value = {0}; MPI_Datatype mystruct; int blocklens[3]; MPI_Aint indices[3]; - MPI_Datatype old_types[3], type2; - int i,j; + MPI_Datatype old_types[3]; + MPI_Datatype type2; MPI_Init( &argc, &argv ); MPI_Comm_rank( MPI_COMM_WORLD, &rank ); - int tab[2][3]={{1*rank,2*rank,3*rank},{7*rank,8*rank,9*rank}}; + int tab[2][3]={{1*rank,2*rank,3*rank},{7*rank,8*rank,9*rank}}; MPI_Type_contiguous(3, MPI_INT, &type2); MPI_Type_commit(&type2); @@ -50,21 +55,21 @@ int main(int argc, char **argv) value.b=8.0; }else{ value.a=10000; - value.b=5.0; + value.b=5.0; } MPI_Bcast( &value, 1, mystruct, 0, MPI_COMM_WORLD ); printf( "Process %d got %d (-2?) and %f (8.0?), tab (should be all 0): ", rank, value.a, value.b ); - for(j=0; j<2;j++ ) - for(i=0; i<3;i++ ) + for (int j = 0; j < 2; j++) + for (int i = 0; i < 3; i++) printf("%d ", tab[j][i]); printf("\n"); /* Clean up the type */ - MPI_Type_free( &mystruct ); - MPI_Type_free( &type2 ); - MPI_Finalize( ); + MPI_Type_free(&mystruct); + MPI_Type_free(&type2); + MPI_Finalize(); return 0; }