[openib-general] [PATCH] osm: port to WinIB stack - 64 bits
Sasha Khapyorsky
sashak at voltaire.com
Sun Oct 15 15:44:06 PDT 2006
On 23:22 Sun 15 Oct , Yevgeny Kliteynik wrote:
>
>
> Sasha Khapyorsky wrote:
> > On 17:45 Sun 15 Oct , Yevgeny Kliteynik wrote:
> >> Hi Sasha,
> >>
> >> Sasha Khapyorsky wrote:
> >>> Hi Evgeny,
> >>>
> >>> On 16:31 Sun 15 Oct , Yevgeny Kliteynik wrote:
> >>>> Hi Hal
> >>>>
> >>>> This patch fixes a few data type problems with OSM on
> >>>> 64-bit Windows machines.
> >>> Could you explain what those problems are?
> >>
> >> Basically, in all three files the problem was assigning
> >> the result of pointer arithmetics (which is __int64) to
> >> an int/uint variable.
> >> Casting to int is ok because, as I said, this result is
> >> actually string length, index in table, or index in string,
> >> so no range check is required.
> >
> > So isn't it better to shut-up compiler warnings/whatever with appropriate
> > warning level flags instead of putting confused castings in the code?
>
> Personally, I don't like the idea of decreasing compiler's
> "suspiciousness" - it will result in writing less portable
> code.
Explicit casting does not help in code portability, this may only hurt
since hides potential problems. Also in general it is good idea to run
compiler with warning level increased from time to time and to analyze
the problems - default flags setting does not prevent to do this.
> Just imagine what would it take to port OSM from Linux to
> Windows, if the Linux code wasn't originally compiled with
> a strict compiler.
>
> > (I know there are couple of such already, but I don't think it was a
> > good idea).
>
> IMO, small price to pay.
Small or not, it still be price (also it becomes *(many times)). Why it
is necessary if there are other simple way to achieve the same?
Sasha
More information about the general
mailing list