Funktion Overload


hab ein kleines problem mit dem Überladen.
folgende funktionen existiern:
code: [select]

void write_data(uint8_t data);
void write_data(uint8_t byte1, uint8_t byte2);
void write_data(uint8_t* bytes, uint8_t count);


bei write_data(0,0); sagt der compiler: error: call of overloaded 'write_data(int, int)' ambiguous
bei write_data(0x00,0x00); sagt der compiler: error: call of overloaded 'write_data(int, int)' ambiguous
bei write_data(1,0); compiliert er
bei write_data(0x01,0); compiliert er

warum erkennt er zwei nullen als int?
wie kann ich das problem lösen (schön und ohne typecast)?

1) konstanten kann man auch explizit definieren:

code: [select]

const uint8_t typed_zero = 0;


2) warum nicht mit suffix:
http://arduino.cc/de/reference/integerconstants


Arduino Forum > International > Deutsch (Moderator: uwefed) > Funktion Overload


arduino

Comments

Popular posts from this blog

Convierte tu Raspberry en un NAS. Firmware fvdw-sl 15.3 - Raspberry Pi Forums

How to format a Get Request

avrdude: verification error, first mismatch at byte 0x0000 0x0c != 0x62