I think I could sed "s/pin direction/call init/g" from the previous topic 
about setting pin direction, and you'd have my answer: flexibility is more 
important than convenient (IMHO, of course).

So...


> Well, being an old-age programmer ;-) I'm used to the fact that include
> header files in C-language do not execute code at program start.

Yes, me too, I fully agree, perfect, I like it :)

> And I'm also used to call a function only at the moment I need it.

This makes sens, I fully agree, I like it

> Thus so far in my PIC programs I had no reason to do it differently....

Me too, I can't any reason why this would be different !

> When I saw the first time setup() being called by the library itself it
> was sort of a shock to me.

Yes, that was a shock to me, too. I just thought to myself: "why ?"

> But I realized quickly the advantage. 

Errr... This is where I disagree :)

> > Please let me know what you think.

As Eur said, setup() (or init()) can take time, can change the state of the 
PIC. I may need to activate the lib via setup() at only a certain of the 
program execution. I hear you say "hey he starts again with his 'what if' 
here and 'what if' there, the fact is no one here can see a practical 
situation where such flexibility is needed"... First, it's not because no one 
can see such a situation that no one will need it. Second, just for the fun, 
here's such a situation. 

You just want to build a protoyping board to test two LCD type. A switch allow 
to test either one LCD or the other. The PIC reads the switch state before 
actually setup one LCD or the other. So, I need to choose which setup() to 
run, to manually have control on it.

How to do this when setup() is called automatically at include time ? Again, 
such a constraint is not worth. I vote for flexibility: let the user call the 
setup().


Seb
-- 
Sébastien LELONG
http://www.sirloon.net
http://sirbot.org

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to