Skip to content

Fixed-width integer type aliases are leaked from USBAPI.h #510

Open
@inicula

Description

@inicula

It seems inappropriate that u8, u16, and u32 are leaked from USBAPI.h, which in turn is included in Arduino.h, and thus polluting the global namespace:

typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned long u32;

If you try to define u16 yourself as using u16 = uint16_t; while including Arduino.h, you'll get a compilation error because this alias conflicts with the one from USBAPI.h.

Is this behavior intended?

Activity

matthijskooijman

matthijskooijman commented on Nov 5, 2022

@matthijskooijman
Collaborator

Sounds wrong to me, I'd be in favor of removing them. Especially since (at first glance) it seems the header file does not actually use these types at all either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      Fixed-width integer type aliases are leaked from `USBAPI.h` · Issue #510 · arduino/ArduinoCore-avr