At 22:03 2002-11-24 -0800, you wrote:
Agreed... however, all of the examples in the SDK were written originally using CodeWarrior as the compiler, which explains why things would be written to avoid warnings that CW raises.Ben,Thanks for the info. > In short, the "static" keywords are used to keep CodeWarrior from > complaining about the lack of prototypes for these functions. BTW, this isn't a CodeWarrior forum, is it?! One mustn't assume... ;-)
True, but remember also that a function definition also serves the the prototype for the function, if its seen before users. If you use static functions and define them in a bottom-up order, then you don't need to write separate prototypes.First, I always use prototypes in my modules. Not for "showing the intention to export the function to other modules", but for the reason stated in K&R 2nd edition; "The new syntax of function prototypes makes it much easier for a compiler to detect errors in the number of arguments or their types".
Second, I use the free command-line tools since this is my first foray into Palm OS programming (tho, I've been programming in C for more than a dozen years). GCC has made no "complaints" about my not using static in the last few functions I wrote, I was just looking at my listing for inconsistencies now that the basic functionality is completed, and lo! I see that I had been omitting the static qualifier - that got me to wondering why I had put ANY of them in, then a review of the book and code samples, etc. showed everyone else using static, so I wrote the original question.
That's fine... each compiler writer/vendor chooses what warnings to implement.
I think -Wall turns on most of the warnings in GCC -- there is plenty of online documentation for GCC and its derivatives for you to check.So, a further question: Does CodeWarrior complain where GCC does not? Or are you assuming that I am NOT using prototypes at the beginning of my source module? Perhaps I should increase my warning level on GCC. Is there a way to do this? I don't see a compiler switch ala -W3 in MSC.
--
Ben Combee <[EMAIL PROTECTED]>
CodeWarrior for Palm OS technical lead
Palm OS programming help @ www.palmoswerks.com
--
For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
