Changing Uno I2C SCL clock frequency

Hellow,

can someone tell me why sometimes i see:

Wire.begin();
Wire.setClock(400000L);

and sometimes :

Wire.begin();
Wire.setClock(400000);

any difference ?

any difference ?

Yes, the first defines the literal explicitly as a long while the later does that implicitly. The result is the same as the compiler realizes without the hint that the number needs 32bit to be stored.

pylon:
Yes, the first defines the literal explicitly as a long while the later does that implicitly. The result is the same as the compiler realizes without the hint that the number needs 32bit to be stored.

When the results are the same, why are there two conventions of representation? There should be some merits/demerits like 'unsigned int' and 'uint16_t'.

When the results are the same, why are there two conventions of representation?

You can code some stuff explicitly or implicitly, the result is the same.

uint16_t a = 39;
uint32_t b = a;

does the same as

uint16_t a = 39;
uint32_t b = (uint32_t)a;

but the second version does the cast explicitly.

If you have to specify a long literal explicitly you can use the 'L' postfix. Let's assume

class x {
  int foo(uint32_t value) { Serial.println("Long"); };
  int foo(uint16_t value) { Serial.println("Short"); };
}

void setup() {
  x test();
  test.foo(48);
  test.foo(48L);
}
void loop() {}

The first and the second call of the foo() method won't result in the same output.