This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Avoid more problems with type clashes


On Wed, Mar 12, 2003 at 07:08:49PM -0500, J. Johnston wrote:
> I hadn't forgotten.  I do not understand why you are
> avoiding the fpos_t type.  It is supposed to be defined by stdio.h.
> 
> Could you provide a little more detail the actual problem you are seeing
> that this patch fixes?

fpos_t != _fpos_t.

_fpos_t as well as _fpos64_t are the definitions internally to newlib. 
So it should be used by internal functions to avoid type clashes with
the type fpos_t which could change.

See stdio.h:

  #ifdef __CYGWIN__
  #ifdef __CYGWIN_USE_BIG_TYPES__
  typedef _fpos64_t fpos_t;
  #else
  typedef _fpos_t fpos_t;
  #endif
  #else
  typedef _fpos_t fpos_t;
  #ifdef __LARGE64_FILES
  typedef _fpos64_t fpos64_t;
  #endif
  #endif /* !__CYGWIN__ */

Cygwin up to the recent 1.3.21 doesn't define __CYGWIN_USE_BIG_TYPES__
so fpos_t == _fpos_t == 32bit.  The next version of Cygwin will define
__CYGWIN_USE_BIG_TYPES__ and then the types fpos_t and off_t are 64bit
types.  This shall work without any user intervention, no extra functions
for 64bit file access needed.

A newly compiled program will further use "fgetpos" but it will actually
call "fgetpos64" while applications built with Cygwin up to 1.3.21 will
still call the old entry points.  But since newlib itself uses fpos_t
internally so far, the 32bit entry points are either wrong compiled or
the compiler complains at compile time as soon as __CYGWIN_USE_BIG_TYPES__
is defined.


Corinna

-- 
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.
mailto:vinschen at redhat dot com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]