cgal
cgal copied to clipboard
char type variable compare with EOF(-1) error in build type -Werror=type-limits
Please use the following template to help us solving your issue.
Issue Details
compilation error: char default as unsigned char in ARM platform, cause char type variable compare with EOF(-1) error in build type -Werror=type-limits
Source Code
example:
char c;
....
if (c == EOF)
printf("CoreIO::read_from_file(), unexpected end of file.");
error log:
CGAL/CORE/CoreIO_impl.h:106:9: error: comparison is always false due to limited range of data type [-Werror=type-limits]
if (c == EOF)
CGAL/CORE/CoreIO_impl.h:194:60: error: comparison is always true due to limited range of data type [-Werror=type-limits]
for (int i=0; (i<size)&&((c=skip_backslash_new_line(in)) != EOF ); i++) {
Environment
- Operating system (Windows/Mac/Linux, 32/64 bits): Linux, 64bit
- Compiler: aarch64-linux-gnu-g++, aarch64-linux-gnu-gcc
- Release or debug mode: Release
- Specific flags used (if any): -Werror=type-limits
- CGAL version: 5.0
- Boost version: libboost1.65-dev:amd64
- Other libraries versions if used (Eigen, TBB, etc.):
Seems like the c == EOF
has been fixed previously in some but not all the cases (e.g. https://github.com/CGAL/cgal/blob/master/CGAL_Core/include/CGAL/CORE/Real_impl.h#L210).
Fixed by https://github.com/CGAL/cgal/pull/7100