How To Know What To Do?

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: How To Know What To Do?

Post by Solar »

It doesn't.
Every good solution is obvious once you've found it.
montrom
Member
Member
Posts: 86
Joined: Thu May 13, 2010 1:45 pm

Re: How To Know What To Do?

Post by montrom »

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.
sprints
Posts: 10
Joined: Wed Jun 02, 2010 6:59 pm

Re: How To Know What To Do?

Post by sprints »

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
montrom
Member
Member
Posts: 86
Joined: Thu May 13, 2010 1:45 pm

Re: How To Know What To Do?

Post by montrom »

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.
Visit the Montrom user page for more info.
rknox
Member
Member
Posts: 55
Joined: Wed Apr 28, 2010 9:07 am

Re: How To Know What To Do?

Post by rknox »

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.
montrom
Member
Member
Posts: 86
Joined: Thu May 13, 2010 1:45 pm

Re: How To Know What To Do?

Post by montrom »

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.
@Necro-Troll: The same would happen in any academic circle.
Visit the Montrom user page for more info.
Post Reply