Darren.Reed at Sun.COM
2007-Apr-26 00:30 UTC
[dtrace-discuss] requiring array indices be int64_t
With dtrace, I can use function arguments in the form of arg0, arg1, etc, as indices into an "associative" array. If all that an array takes as an index is an int64_t, is there any reason for dtrace to require me to have an explicit type conversion in there rather than having it do it for me automatically? At present I need to do: mblks[arg0] or mblks[(int64_t)((mblk_t *)arg0)->b_cont] whereas what I''d like to be able to do is: mblks[arg0] and mblks[((mblks_t *)arg0)->b_cont] and have dtrace worry about what b_cont needs to be transformed into in order for that to work. Darren
> With dtrace, I can use function arguments in the form of> arg0, arg1, etc, as indices into an "associative" array. > > If all that an array takes as an index is an int64_t, is there > any reason for dtrace to require me to have an explicit type > conversion in there rather than having it do it for me > automatically? > > At present I need to do: > mblks[arg0] > or > mblks[(int64_t)((mblk_t *)arg0)->b_cont] Use args[0] instead. -- meem