dimanche 19 avril 2015

Is this a bug in the compiler or how C normally works?

I'm using the XC8 compiler which targets 8 bit microcontrollers.


This does not produce any warnings or errors, but hangs the microcontroller anyway:



uint8_t some_array[4];
uint8_t // no compile errors at all
some_function();


Another thing I've noticed, expect this one does not crash the microcontroller, and seems to return 0:



printf("%c", some_function);


In this one, I'm calling a function which never returns a 0. I've forgotten to add the () but it compiles and somehow runs anyway, but with a wrong return value.


Aucun commentaire:

Enregistrer un commentaire