Uploaded image for project: 'MariaDB MaxScale'
  1. MariaDB MaxScale
  2. MXS-1659

C includefile json_api.h includes C++ include file cppdefs.hh

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2
    • Fix Version/s: 2.2.2
    • Component/s: Core
    • Labels:
      None
    • Environment:
      Linux CentOS 7.4

      Description

      The includefile include/maxscale/json_api.h in turn includes the file include/maxscale/cppdefs.hh. The issue is that the former is a C-file, both indicated by it's name as well as the content of the file. The latter though is a C++ file. This means that although the functions in json_api.h, which a valid C functions, cannot be used in a C-modeul as the latter includefile is a C++ file and hence insists on C++ code. In general it is bad practice to include a C++ include file in another include file that is distinctly C (including C in a C++ include file is perfectly OK though). In practice this limits someone who is writing a module in C to use the functions defined in json_api.h, despite that these are perfectly valid C functions. testing by removing the inclusion of cppdefs.hh from json_api.h shows that this is not really necessary, everything compiles fine even without json_api.h including cppdefs.hh.

        Attachments

          Activity

            People

            Assignee:
            johan.wikman Johan Wikman
            Reporter:
            karlsson Anders Karlsson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: