• Advertisement
Sign in to follow this  

typedef char FAR charf

This topic is 2864 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I realise this is a basic question, but what does typedef char FAR charf; typedef int FAR intf; //... actually mean. FAR is simply #define FAR. (This is in zconf.h from zlib...)

Share this post


Link to post
Share on other sites
Advertisement
That's a relict from the times of 16bit memory models. The zlib dates back to those days, so it needed to support weird things such like different pointer types for different address ranges. Today it's not necessary anymore (thus it's defined empty as you cited). You can safely ignore it.

Share this post


Link to post
Share on other sites
Some older systems used to use segmented addressing.

Ane example was some of the older 16 bit Intel processors. You could address memory inside a segment using so called "near" pointers (16 bit addresses). To address memory between segments you would need a "far" pointer (which was effectively a 20 bit pointer constructed from two 16 bit values).

On such systems, FAR could be #defined to some compiler-specific way of annotating far pointers.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement