Re: [sc-dev] Removing ULONG

Carsten Driesner <[email protected]>
Newsgroups gmane.comp.openoffice.devel.general
Message-ID <[email protected]>
Am 01/17/2011 11:12 PM, schrieb Regina Henschel:
> Hi all,
>
> I'm currently looking in ScBinomDist to remove the PushNoValue() cases.
> I see a lot of ULONG there and as Carsten has announced, that ULONG will
> be removed, my question now, how I should replace it.
>
> The parameters n (total number of independent trials) and x (number of
> successful trials) are integers in ODF. As we store them in double, they
> are exact up to 48Bit. The code has some for-loops up to this
> parameters. What type shall I use for the index i in the loops?
Hi Regina,

ULONG is the most problematic type in tools/solar.h. The current mapping 
is that ULONG is the same type as sal_uIntPtr (which means an unsigned 
integer which can store a pointer). That's not exactly true for every 
code which I have seen during the conversion. There is old code which 
assumes that ULONG is the same type as sal_uInt32. There is also other 
code which assumes that ULONG can store a pointer. Both assumptions are 
true for (as far as I know) all 32-Bit systems but not for 64-Bit!
Therefore we "created" a new type called "sal_uLong" (typedef 
sal_uIntPtr) which should only be a temporary solution. Hopefully 
developers who work on code, exchange sal_uLong with the correct type 
depending on the context. The new type "sal_uLong" was only used for the 
semi-automatic tools type removal and should NEVER be used for new code.
Normally it's safe to use unsigned long or a sal_uInt-type. Attention 
must be paid to code which is used to stream to/from the file system. 
Using sal_uIntPtr there would be a real problem due to the difference 
between 32- and 64-Bit systems.

Regards,
Carsten
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.