gcc C++ app: need a double, but gcc converts back to long
Mike MacCana
mike.maccana@gmail.com
Wed Apr 18 00:29:00 GMT 2007
I have a small, Open Source C++ app that compiles properly with gcc.
I'm not an experienced C++ programmer, but I only have a very small
problem to solve: the app fails on all files larger than 4.2GB. The
author of the app isn't contactable, but I'm fairly sure this is
likely due to a simple typing issue on a variable called fileSize.
Line 191 of utils.cpp:
unsigned long fileSize = FileSize(fileName);
Simple enough. But when I change it to be a double,
double fileSize = FileSize(fileName);
gcc gives the following warning:
utils/utils.cpp:191: warning: converting to 'long unsigned int' from 'double'
Why does GCC do this conversion? How can I keep fileSize long?
Mike
More information about the Gcc-help
mailing list