Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/07/00 06:29
Read: times


 
#4189 - RE: Mystic switch()/"Address space overflow&q
Hi Oleg,

A:

case MUSIC1: msc_key(); break;

case MUSIC2: msc_key(); break;

case MUSIC3: msc_key(); break;

case MUSIC4: msc_key(); break;



B:

case MUSIC1:

case MUSIC2:

case MUSIC3:

case MUSIC4: msc_key(); break;



A: and B: does exact the same, but B: generate shorter code.


01. What's the mystery of "address space overflow" error?
Why the error depend on an uncalled segment?

Since the linker assume, the function was called by a pointer, it can not overlay the data of this function. And it seems many data was used and so an overflow occur.
Overlay means, if the linker detect, that 2 functions never called at the same time, both functions can use the same area of data RAM


02. Why the switch functions differently depending on its
size?

Only some "cases" can be solved easier and faster by comparison operations on every "case".
On many "cases" a table works better. So the compiler use always the best method.



Peter


List of 5 messages in thread
TopicAuthorDate
Mystic switch()/"Address space overflow"            01/01/70 00:00      
RE: Mystic switch()/"Address space overflow&q            01/01/70 00:00      
RE: Mystic switch()/"Address space overflow&a            01/01/70 00:00      
RE: Mystic switch()/"Address space overflow&q            01/01/70 00:00      
RE: Mystic switch()/"Address space overflow&a            01/01/70 00:00      

Back to Subject List