31bit arithmetic

·

In my quest to have some kind of access to my Outlook/Exchange calendar, I now got a step further, Even two steps, to be precise:

  1. I got all my appointments, including time zone info into iCal. I have these nifty “confirmed”,“canceled” and “tentative” icons in iCal — something I didn’t get yet with GroupCal. Thanks to the wise men up a Microsoft, I could even “copy-paste” the attributes of repeated events 1:1 into my vCalendar file.
  2. I got all my tasks as well into iCal, something I wanted badly, even if I can’t sync them back for the moment.

This last point, however, caused some laughter among me and Ölbaum.

I wanted to know (In my famous script), how many appointments I’m going to convert. When I ran the script, I got some ridiculous big number ( 2147483647 ) – something which simply can not be true.

When I dug into the documentation for the “ Count” property on CDO Messages collections, I found this:

The Count property returns the number of AppointmentItem, MeetingItem, or GroupHeader and Message objects in the collection, or »a very large number« if the exact count is not available. Read-only.

This »a very large number« actually struck me. Why the heck couldn’t they just put some value like -1 instead of some “very large number”, I asked myself.

Ölbaum then pointed out that 2^31 – 1 = 2,147,483,647 – the number returned by my script. 31bit arithmetic, it seems: 7FFF FFFF happens to be -1 when you use 31bit arithmetic. Uh … oh.

Comments.

No comments. Be the first to add one!
Add a comment.
We'll never share your email with anyone else. We use the Gravatar system to pull in pictures based on an anonymous hash.
Once you submit your comment, it will be moderated and then show up here shortly after.