[SOLVED] effect of Functions name on memory

Status
Not open for further replies.

Sudhp

Member level 4
Joined
Oct 11, 2013
Messages
69
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Location
India
Activity points
528
hii...
I wanna know ...
Is function name effect on memory of micro......
I mean if I have to print a string on lcd and I named the function as...
1. void print(char string[])
2. void print_string_to_display_on_lcd(char string[])
then either both will take same memory of Rom or different memory....
I am only talking about memory taken by function name.....
 

Afaik, the function name is not saved when the code is compiled, so both will use the same amount of space in ROM.
 
Reactions: Sudhp

    Sudhp

    Points: 2
    Helpful Answer Positive Rating
Depends a lot on your compiler and how you configure your project.
You can usually choose to compile with symbols (bigger program) which you do while debugging
and then strip symbols when compiling for distribution resulting in smaller code.

If you cant debug because of memory shortage you can often compile sections of your
code - test/debug them individually then compile with stripped symbols when it all works.
Just be careful the sections you create dont interact and create bugs - and test thoroughly after.
There are different ways to do this depending on your compiler/environment.
Depending on what you are doing it can often be easier to just use a device with more memory to start with.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…