Hi Paul, It's not possible to set a value other than zero to be used as the default value for a variable. The use of zero as the default value is tied to how variables are allocated and freed internally. The initialization of new thread-local variables to zero is fairly baked into the design of DTrace and while it might seem suboptimal to require two variables in the case you described, that's how you'll have to do it.
Adam On Feb 18, 2008, at 5:24 AM, Paul van den Bogaard wrote: > If I understand the docs correctly the only way to initialize self > vars is automatic initialization: zero it is. > > I feel it would be very nice if we could explicitly initialize vars > before their use. To values not zero that is. Currently I have a > situation where the application uses just positive values. zero is a > valid value here that therefore cannot be used to mean > "uninitialized". > I now need another self-> var telling me if the actual variable is > initialized. This flag is set always when that other var is set. And > needs always be used in the predicates to tests if that var has > meaningful information. > Using the value -1 only once would make the code more readable. > > Is this auto init of thread local variables there to stay (design?) > or could it be an enhancement for a future version of DTrace? > > > -- > This message posted from opensolaris.org > _______________________________________________ > dtrace-discuss mailing list > [email protected] -- Adam Leventhal, Fishworks http://blogs.sun.com/ahl _______________________________________________ dtrace-discuss mailing list [email protected]
