Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By inflector
#72259 I'm an experienced C++ programmer and I have never seen code like this that would compile.

From lines 77 to 82 of the WifiTelnetToSerial example project:

Code: Select all  //check UART for data
  if(Serial.available()){
    size_t len = Serial.available();
    uint8_t sbuf[len];
    Serial.readBytes(sbuf, len);


How does one define an array of uint8_t based on a dynamic value not known at compile time? This seems like something I'd see in a dynamic interpreted language, I've never seen it in a C/C++ dialect.

How does this compile? Is this a bug?