How To Know What To Do?
Re: How To Know What To Do?
Agreed. The entire function is a mess with out surprise. No doubt this guy will be back at some point wondering why he can't divide by zero or something equivalent.
Visit the Montrom user page for more info.
Re: How To Know What To Do?
i think a smalltalk manual i read (paraphrasing here).
"The first mistake beginners make is to question how everything works ... Its better to understand that something will work and you will at some point then be able to answer how"
also most of these questions can be solved by a search of the wiki or a good google search
"The first mistake beginners make is to question how everything works ... Its better to understand that something will work and you will at some point then be able to answer how"
also most of these questions can be solved by a search of the wiki or a good google search
Re: How To Know What To Do?
I don't know if I would completely adopt that philosophy, the, "Don't bother learning everything now, we'll get to that sooner or later." is a bit, a ,how do you say, "hogwash"? Would you begin a test before reading the directions? Would you build a house without a blue print? I think what every beginner needs is time to spend learning each new concept before he attempts to apply what he has learned. I don't understand why some people take the approach to kind of throw the arm of the beginner around their shoulders and kind of drag them to the finish line, because this isn't a race, it's not imperative that anyone complete their project in as little time as possible. And, if so, why are you here wasting time?
And, I second that in Quirk Mode: All of these questions could be answered via Google. Assert where necessary.
And, I second that in Quirk Mode: All of these questions could be answered via Google. Assert where necessary.
Visit the Montrom user page for more info.
Re: How To Know What To Do?
Nathan
Regarding the volatile – here are reasons the author might have used this qualifier.
Volatile – does no harm and protects you from certain mischief that the compiler may perform – depending on the compiler and the options that a user selects.
It solves a problem that did not exist in most of the environments where I have programmed.
If you tell a modern C compiler to “optimize” it may use certain logic to completely drop from your program parts that it does not see being used in the compile unit (the file) being processed.
You might assume that it would not do this with variables that are global, since they may be modified elsewhere – for example in an interrupt routine. But the compiler writers have a “mother may I “ approach to this. You must tell them which global variables are subject to magically being changed or used elsewhere. You do this by declaring them volatile.
Thus to be safe, the author may have selected this approach without worrying about whether it really was needed. It does no harm. Perhaps slows down execution by a few microseconds, but probably has no effect.
It appears that others here have taken your request for info as an opportunity to try to put you down. That unfortunately is the price one pays for asking advice in a forum like this. Since no harm results, a way to explore questions like this is to modify the code and see what happens. And to ask questions and have a thick skin.
Regarding the volatile – here are reasons the author might have used this qualifier.
Volatile – does no harm and protects you from certain mischief that the compiler may perform – depending on the compiler and the options that a user selects.
It solves a problem that did not exist in most of the environments where I have programmed.
If you tell a modern C compiler to “optimize” it may use certain logic to completely drop from your program parts that it does not see being used in the compile unit (the file) being processed.
You might assume that it would not do this with variables that are global, since they may be modified elsewhere – for example in an interrupt routine. But the compiler writers have a “mother may I “ approach to this. You must tell them which global variables are subject to magically being changed or used elsewhere. You do this by declaring them volatile.
Thus to be safe, the author may have selected this approach without worrying about whether it really was needed. It does no harm. Perhaps slows down execution by a few microseconds, but probably has no effect.
It appears that others here have taken your request for info as an opportunity to try to put you down. That unfortunately is the price one pays for asking advice in a forum like this. Since no harm results, a way to explore questions like this is to modify the code and see what happens. And to ask questions and have a thick skin.
Re: How To Know What To Do?
@Necro-Troll: The same would happen in any academic circle.rknox wrote:It appears that others here have taken your request for info as an opportunity to try to put you down. That unfortunately is the price one pays for asking advice in a forum like this. Since no harm results, a way to explore questions like this is to modify the code and see what happens. And to ask questions and have a thick skin.
Visit the Montrom user page for more info.