pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: {pkgsrc-users} need help with C# -- how to deal with different time_t widths?

Hi Matthias.

On 7-Sep-2009, at 7:18 AM, Matthias Drochner wrote:
The appended patch fixes the problem for me (on i386-current) but
this needs to be done in a portable way.

You didn't append a patch.

So we need either a C# type which is equivalent to a time_t,
or conditionals.
I'm absolutely clueless about C# -- How can this be done?

Like Java, C# has standard types that don't vary in size depending on the architecture. There are ushort (equivalent to System.UInt16), uint (System.UInt32), and ulong (System.UInt64), and their corresponding signed types short (System.Int16), int (System.Int32), and long (System.Int64). The lower-case are the primitive types, and the System.* are their corresponding classes; C# will automatically box/unbox them as necessary.

C# does have a conditional compilation like C, though nothing like C's #define or typedef. So you could do something like:

        UInt32 blah;
        UInt64 blah;

and provide the define during compilation.


"Amusement to an observing mind is study." - Benjamin Disraeli

Home | Main Index | Thread Index | Old Index