[splint-discuss] Help with mmap() and abstract data type annotations
dwh at ovro.caltech.edu
Sat Nov 1 14:45:12 EST 2003
> Please don't top-post.
Enlighten me? What do you mean by 'top-post'?
And sorry for doing it :)
> I strongly recommend against the casual use of casts,
> especially to shut up warnings. The result may be
> warning free, but can easily contain fatal errors.
> You are immediately overriding the compilers (and
> splint is a form of compiler) judgement with your
> own, and stating 'ignore this'. Unnecessary casts
> are most likely to be a sign of faulty initial thinking.
Ok good. I posted what I had been doing to get feedback
on what I should be doing. So any chance you could
indicate the appropriate way to proceed?
I'm trying to 'improve' my coding style and work habits.
Splint 'encourages' me to do this, so I'd like to
work out how to use it correctly.
So for example, when determining the length of a string,
and assigning it to an int, then passing it off to
a string function and getting a size_t warning,
what should I have really done? Used a size_t right
from the outset is one answer, but is that the
only? How about accessing register values, a hardware
register is defined as a 'volatile unsigned int',
but when I manipulate it, its no longer volatile
once inside a variable ... in that case a cast
to 'unsigned int' seems appropriate.
Owens Valley Radio Observatory.
More information about the splint-discuss