Skip to content

false warning with g++ regarding "Your code is being built against an older version" because __STDC_VERSION__ is not defined #393

@Corin-EU

Description

@Corin-EU

In the header file "jas_config.h" there is the test with warning

 #if (__STDC_VERSION__ - 0 < JAS_STDC_VERSION)
 #warning "Your code is being built against an older version of the C standard than JasPer was.  Although this is supported, this may require some extra preprocessor defines when building."
 #endif

This is a valid(and worthwhile test when code is being compiled with a C compiler eg gcc when the symbol STDC_VERSION is defined with a value by the gcc compiler.

However there is a problem when code is being compiled with a C++ compiler eg g++ because g++ does not define the symbol STDC_VERSION but has a value of the version in the symbol __cplusplus instead.

So test if STDC_VERSION has a value and then use that, otherwise test if __cplusplus has a value and use that, otherwise complain that no version is set.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions