Skip to content

Arduino Compatible types are ambiguous and possibly conflicting #27

@dsyleixa

Description

@dsyleixa

in ArduiPi_OLED_lib.h there are some defines which perhaps conflict with general or arbitrary programs:

        // Arduino Compatible type
        typedef uint8_t boolean;           
        typedef uint8_t byte;      
        //... 
        // GCC Missing            
        #define max(a,b) (a>b?a:b)
        #define min(a,b) (a<b?a:b)     
    

especially the max/min #defines are ambiguous and possibly conflicting because this ArduiPi_OLED lib is used by gcc on the Pi, and for gcc both max and min are perhaps already defined in other libs (e.g., max / min (namespace std) or in different optional/proprietary libs)

solutions:
(a) drop all completely, they make no sense in a OLED lib for the Pi
(b) enable them only when a global MAKRO is not defined, like e.g. (how it's done fo millis() etc):
#ifndef ARDUIPIOLED_NO_ARDUINISH_COMPATIBILITY

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions