Skip to content

Found use of possibly reserved identifier #1675

@philipjonsen

Description

@philipjonsen

DESCRIPTION:

Using reserved identifiers can cause conflicts with the compiler or other system libraries, leading to unexpected behavior or compilation errors.

To fix this issue, choose a different identifier that is not reserved by the implementation. It is recommended to follow naming conventions and avoid using names that are reserved by the language or the compiler.

The C and C++ standards reserve the following names for such use: - identifiers that begin with an underscore followed by an uppercase letter; - identifiers in the global namespace that begin with an underscore.

The C standard additionally reserves names beginning with a double underscore, while the C++ standard strengthens this to reserve names with a double underscore occurring anywhere.

BAD PRACTICE:
namespace NS {
void __f(); // Reserved identifier, not allowed in user code
using _Int = int; // Reserved identifier, not allowed in user code
#define cool__macro // Reserved identifier, not allowed in user code
}

int _g(); // Reserved identifier, disallowed in global namespace only

RECOMMENDED:
namespace NS {
void f(); // Non-reserved identifier, allowed in user code
using Int = int; // Non-reserved identifier, allowed in user code
#define cool_macro // Non-reserved identifier, allowed in user code
}

int g(); // Non-reserved identifier, allowed in global namespace

declaration uses identifier 'WEBCACHE_H', which is a reserved identifier
https://github.com/bloominstituteoftechnology/C-Web-Server/blob/master/src/cache.h#L2C21-L2C21

declaration uses identifier 'FILELS_H', which is a reserved identifier
https://github.com/bloominstituteoftechnology/C-Web-Server/blob/master/src/file.h#L1

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