Stephan Bergmann wrote: > >I wince when I read "obviously" in this context. I grant you the > >pessimization argument, that's what I was alluding to with my loop > >counter example - but still, except for the most simple cases, these > >have a tendency to later spread their value's usage into surrounding > >code. Let's stick with the default choice of "use the sal_* types", > >unless there are more convincing arguments. > > Re wincing at obviousness of matching range: How is that any > different for plain int (with INT_MIN--INT_MAX range) vs., say, > sal_Int32 (with SAL_MIN_INT32--SAL_MAX_INT32 range)? > Because it's at least consistently too small (_if_ it is too small). ;)
> >I think that causes more harm than benefit, and many extra > >opportunities for subtle platform differences. Make up your mind > >what range you want to support, and then choose a sal type. > > I see your point here, but am not entirely convinced. > Both my paragraphs boil down to defaulting to the Principle of Least Surprise - in terms of algorithmic behaviour, not in terms of speed, I admit. But if I have to choose, I'm personally certain which side to pick (mind you, I'm still talking about general rules to put into coding standards here, not about exceptions). Cheers, -- Thorsten
pgp9HidWmCB2V.pgp
Description: PGP signature