Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-4680

TBufferTransports.h does not compile under Visual Studio 2017

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 0.11.0
    • Fix Version/s: 0.12.0
    • Component/s: C++ - Library
    • Labels:
      None
    • Environment:

      Visual Studio 2017

      Description

      When compiling under Windows 10 and including TBufferTransports.h, compilation fails with

      Error    C2589    '(': illegal token on right side of '::' (compiling source file [...][...]\thrift-0.11.0\lib\cpp\src\thrift\transport\tbuffertransports.h    452

      The error seems to be caused by the fact that in windows.h a macro max is defined.

      Possible work arounds are to define NOMINMAX in order to prevent windows.h to define the macro max.

      Alternatively, before the statement on line 452 undefine the macro

      #undef max
      maxBufferSize_ = std::numeric_limits<uint32_t>::max()

      However, I would prefer a version, where it is checked whether max is defined as a macro, and if so, to use the other, correct syntax for this case of:

      maxBufferSize_ = (std::numeric_limits<uint32_t>::max)();

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jking3 James E. King III
                Reporter:
                sebastian.stueker@karlsruhe-it-solutions.com Sebastian Stüker
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m