> #define VALGRIND_DO_CLIENT_REQUEST( \ > _zzq_rlval, _zzq_default, _zzq_request, \ > _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \ > - { volatile unsigned long long int _zzq_args[6]; \ > - volatile unsigned long long int _zzq_result; \ > - _zzq_args[0] = (unsigned long long int)(_zzq_request); \ > - _zzq_args[1] = (unsigned long long int)(_zzq_arg1); \ [[snip]] > + { volatile uint64_t _zzq_args[6]; \ > + volatile uint64_t _zzq_result; \ > + _zzq_args[0] = (uint64_t)(_zzq_request); \ > + _zzq_args[1] = (uint64_t)(_zzq_arg1); \ [[snip]] > > but this only handle 64bit, i need solulition that work both ways when i > compile to 32bit/64bit executable
Use "void *" to handle the native width: volatile void *_zzq_args[6]; volatile void *_zzq_result; _zzq_args[0] = (void *)(unsigned long)(_zzq_request); _zzq_args[1] = (void *)(unsigned long)(_zzq_arg1); [[snip]] The cast to "(unsigned long)" is required to avoid the complaint from gcc: cast to pointer from integer of different size [-Wint-to-pointer-cast] when -m64 and _zzq_arg1 is only an 'int'. This solution depends on sizeof(void *) <= sizeof(unsigned long) for which the only important exception is Microsoft C in 64-bit mode. [MSVC chooses 4==sizeof(long) in *ALL* cases.] Note that the producer and the consumer must agree on the actual type of each argument, particularly 'unsigned' or not, and 'long' or not. Otherwise it is impossible to choose a type for casting the pass-through arguments that conveys the correct value in all cases of mismatched expectations. ------------------------------------------------------------------------------ Dive into the World of Parallel Programming! The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net _______________________________________________ Valgrind-users mailing list Valgrind-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/valgrind-users