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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/04/10 13:31
Read: times


 
#173841 - this IS part of the C-hatred
Responding to: ???'s previous message
Erik Malund said:
I mean to clear the *whole* memory upon startup. I'd even consider that harmful.
a) why do you consider that 'harmful' the RAM is random after power up.

I consider harmful even the "all not explicitly initialised global/static variables are zeroed upon startup". This is a C-specific thing.

I hate when machines try to do "smart" things for me. I want to have control.

Erik Malund said:

b) if a problem, then 'misuse' startup

It can be turned around: if the startup would clear only the static/global variables, and that would be a problem, it still could be 'misused'.

Now my choice would be no clear, but the C standard REQUIRES the static/global variables to be cleared, so that must be obeyed. Both the least-harm and least-surprise principles would guide NOT to clear anything else.

Of course "clear all" is the simplest way of doing things, along the least-resistance path. I would say, Herr Keil was a bit lazy when dealing with this particular detail back then, and it simply remained so.

Erik Malund said:
Mr C hater: in assembler, would you carefully clear only what was not to be initialized or would you clear the whole shebang with a simple loop and then set the initialized values

As said above, in [my] asm (and in Pascal), there is no "always clear all just to be sure"; and that's how it's good IMHO.

Erik Malund said:

Btw., how does Keil know how much XRAM is connected?
as posted
The startup code (if not misused)
i.e. the correct value is entered. an incorrect value would constitute 'misuse'

Oh, I see. And I see how THAT can constitue a potential source of error, too.

So, if I don't enter the correct value (wherever it could be entered), or I enter an incorrect value (e.g. stating less XRAM than actually used by the program), and I run the simulator, are the XRAM bytes zeroed?

JW


List of 35 messages in thread
TopicAuthorDate
Problem with strings in C            01/01/70 00:00      
   You missed a fundamental point on how 'C' does strings            01/01/70 00:00      
      I think you don't need to be mysterious here, Andy            01/01/70 00:00      
         Strings in 'C' *must* be NUL-terminated            01/01/70 00:00      
   A little whitespace goes a long way            01/01/70 00:00      
   conversion on top of conversion            01/01/70 00:00      
      Null termination            01/01/70 00:00      
         Think about it...            01/01/70 00:00      
         so is your problem solved or not?            01/01/70 00:00      
            "lucky" or "unlucky"?            01/01/70 00:00      
               rather            01/01/70 00:00      
                  Yes - that's what I meant!            01/01/70 00:00      
            That, in fact, IS it            01/01/70 00:00      
               how true            01/01/70 00:00      
               Debugger != Simulator            01/01/70 00:00      
               if that is true, find another job!            01/01/70 00:00      
                  Does Keil initialise non-static data?            01/01/70 00:00      
                     the very first thing ...            01/01/70 00:00      
                        this is not the case..            01/01/70 00:00      
                           Mr C hater:            01/01/70 00:00      
                              this IS part of the C-hatred            01/01/70 00:00      
                                 but you do            01/01/70 00:00      
                                    and what are the unzeroed values, then?            01/01/70 00:00      
                                       I have no idea            01/01/70 00:00      
                                    Many Reasons for not clearing (all of) RAM            01/01/70 00:00      
                                       I actually gave an example.            01/01/70 00:00      
                                       Another Example...            01/01/70 00:00      
                                          what I wold do            01/01/70 00:00      
                                             I Elect to Totally Disagree            01/01/70 00:00      
                                                a reply            01/01/70 00:00      
                                                   I'll take the time to reply when...            01/01/70 00:00      
                                                   It's too easy            01/01/70 00:00      
                                                      Auro variables are always undefined            01/01/70 00:00      
                                                Seconded!            01/01/70 00:00      
                                                   makes assumptions?            01/01/70 00:00      

Back to Subject List