Tactif CIE
Well-known member
Not related with Teensy but in my experiments with hard_fault_isr() I'm trying to produce weird, stupid crashes... I thought this silly code would not run, but yes it runs, and I really don't understand why
Any idea ?
Any idea ?
Code:
#include <Arduino.h>
char array[8192] = {0xAA};
class Foo {
int b = 1;
public:
void some() {
Serial.println("Some");
}
void boid(int i) {
Serial.printf("boid %i %ld\n", i, millis());
}
};
class Bar {
public:
void none() {
Serial.println("none");
}
};
void setup() {
Serial.begin(115200);
while (millis() < 800)
;
}
void loop() {
Foo *foo_ptr;
Bar *bar_ptr;
foo_ptr = (Foo *)&bar_ptr;
foo_ptr->boid(1);
foo_ptr = (Foo *)0L;
foo_ptr->boid(2);
foo_ptr = (Foo *)&array;
foo_ptr->boid(3);
delay(500);
}