Go Down

Topic: Memory and unused functions in a library (Read 351 times) previous topic - next topic


well not exactly a library just another c file and header file , ive yet to learn about libraries and linking so for now i am only writing things in separate c and h files
but i wonder if i write a generic c file with multiple functions for doing a lot of tasks but  i only use some of them in my main c file do the unused ones take up memory?

I could print the Arduino logo on a box of cereal and sell it as "Arduin-O's"


The compiler is smart enough to get rid of unused code. Of course, you could always write small example and test it yourself.


Sometimes a class or variable or interrupt routine is still in the compiled file, even when it is not used.

I use defines to disable blocks of code.

Code: [Select]

// Select which one to use

// #define ENABLE_I2C


  // do someting with the temperature sensor
  float temperature = getTemperature();
  Serial.println( temperature);

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131