tfussell / xlnt

:bar_chart: Cross-platform user-friendly xlsx library for C++11+
Other
1.49k stars 418 forks source link

Trailing comma in array prevents compilation with certain compilers #502

Open ystkc opened 4 years ago

ystkc commented 4 years ago

1 Perhaps the comma here is not suitable,there is no value behind it ! And it also cause the crash of the compiling ! How did you pass the compiling?

sukoi26 commented 4 years ago

On LINUX + GCC no crash ,no warm ( compiler behavior ?)

ystkc commented 4 years ago

I can also compile it with my c++11,but when I use Visual Studio2017(Windows7) to compile it,it crashed. Perhaps you are right. 1

sukoi26 commented 4 years ago

VISUAL bug if it crashes, at least a compiler error message is required. but how do you know that this is the code that crashes? (log file?) You are right the last comma is not requested

l937928908 commented 4 years ago

I also encounter the same problem in vs2017, which is saved as urf16be, and there are some small problems:

constexpr typename std::common_ type<NumberL, NumberR>::type max(NumberL lval, NumberR rval)

constexpr typename std::common_ Type < NUMBERL, numberr >:: type min (NUMBERL lval, numberr rval), Max and min are redefined in windows10

In the file minwindef. h

tfussell commented 4 years ago

I think this is allowed in the C++11 standard. I don't use this trailing comma style elsewhere so I'm fine with removing it if it's preventing the code from compiling in certain compilers.

matteocostantini commented 4 years ago

I also encounter the same problem in vs2017, which is saved as urf16be, and there are some small problems:

constexpr typename std::common_ type<NumberL, NumberR>::type max(NumberL lval, NumberR rval)

constexpr typename std::common_ Type < NUMBERL, numberr >:: type min (NUMBERL lval, numberr rval), Max and min are redefined in windows10

In the file minwindef. h

Can you help about this trouble? I have this trouble since i update from 1.3.0 to 1.5.0 . my project that import xlnt symbols including <xlnt/xlnt.hpp>.

tfussell commented 3 years ago

The solution for the min/max collision from Windows.h is to define NOMINMAX before importing Windows.h, but I believe I have a fix that doesn't require the user of the library to do anything. I'll push a PR for that soon.

I'm unable to reproduce the trailing comma issue in VS 2019. If anyone still has that problem, could you please remove it from the file number_formatter.cpp and see if that is the only problem? If so I can push another PR to fix that.