Saving memory by using constants

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Nov 2008
Posts: 1
Reputation: PieterN is an unknown quantity at this point 
Solved Threads: 0
PieterN PieterN is offline Offline
Newbie Poster

Saving memory by using constants

 
0
  #1
Nov 25th, 2008
I'm new to c++ programming and use it to program a microcontroller. Since memory is limitted (only 12 kb), I'm looking for a way to reduce memory usage when using some large arrays with floats that are constants. Is it possible to somehow write these arrays to ROM without them having to be transferred to memory before usage?

I did try something like:
  1. static const float myArray[100] = {1.23, 4.56, .... }

, but this does not seem to be working.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 2,001
Reputation: ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of 
Solved Threads: 343
ArkM's Avatar
ArkM ArkM is offline Offline
Postaholic

Re: Saving memory by using constants

 
0
  #2
Nov 25th, 2008
It's not C++ language question. It's a question about YOUR compiler and linker. Read the compiler reference guide carefully, look at module map, try and see what happens - and so on...
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 751
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Saving memory by using constants

 
0
  #3
Nov 25th, 2008
And if you're still stuck after reading, then tell us which compiler you're using.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum


Views: 376 | Replies: 2
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC