Daniel Lemire's blog

, 1 min read

Long File Support in GCC (C++)

This is a boring technical post.

GCC 3.4 has long file support builtin for C++ see the _GLIBCXX_USE_LFS flag in “c++config.h”. If you check the file “g++-v3/istream”, you’ll notice that the “seek get location” function is defined as “seekg(off_type)” where “off_type” is a typedef for “streamoff” which, itself, is defined as:


#ifdef _GLIBCXX_HAVE_INT64_T
typedef int64_t streamoff;
#else
typedef long long streamoff;
#endif

So, when you seek get or put positions in a file, you are actually passing a 64 bits integer.

Of course, it would be surprising if GCC would not support long files by default in C++, but I’m the curious type.