[MXS-1659] C includefile json_api.h includes C++ include file cppdefs.hh Created: 2018-02-08  Updated: 2018-02-08  Resolved: 2018-02-08

Status: Closed
Project: MariaDB MaxScale
Component/s: Core
Affects Version/s: 2.2
Fix Version/s: 2.2.2

Type: Task Priority: Minor
Reporter: Anders Karlsson Assignee: Johan Wikman
Resolution: Fixed Votes: 0
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.


Generated at Thu Feb 08 04:08:27 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.