gcc C++ app: need a double, but gcc converts back to long

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux