xlnt icon indicating copy to clipboard operation
xlnt copied to clipboard

Trailing comma in array prevents compilation with certain compilers

Open ystkc opened this issue 4 years ago • 7 comments

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?

ystkc avatar Aug 15 '20 10:08 ystkc

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

sukoi26 avatar Aug 15 '20 15:08 sukoi26

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

ystkc avatar Aug 17 '20 02:08 ystkc

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

sukoi26 avatar Aug 17 '20 07:08 sukoi26

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

l937928908 avatar Aug 17 '20 13:08 l937928908

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.

tfussell avatar Aug 20 '20 19:08 tfussell

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>.

matteocostantini avatar Sep 23 '20 11:09 matteocostantini

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.

tfussell avatar Jan 02 '21 21:01 tfussell