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

    • Task
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 2.2
    • 2.2.2
    • Core
    • None
    • 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

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

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.