Hi Paul,

I guess gcc is not as strict as other C-compilers around. You could use -Wall and it will warn you about not declared prototypes, at least if the function return value differs from the default (int).

I use prototypes for all my functions regardless, if only used inside a module and therefore static, or outside as well. If I'm too lazy for it, then I at least write the new function above the other function, which will call it. Then gcc knows about the new function already, and will use its calling template without a prototype.

Have a look into your K&R book (even if I never had seen one from near) and read the chapter about qualifiers to functions and variables. It's very interesting to understand why and when to use static, const, volatile etc.

Have a nice week,
Henk


Paul wrote:
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...  ;-)


But the compiler is complaining because it either wants a prototype
(showing the intention to export the function to other modules) or it
wants

a static keyword (making sure the global namespace isn't polluted).

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.

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.

TIA,

-Paul





--
-------------------------------------------------------------------------
[EMAIL PROTECTED]                                       www.metaviewsoft.de

<A HREF="http://www.handango.com/PlatformTopSoftware.jsp?authorId=95946";>
<IMG SRC="http://user.cs.tu-berlin.de/~jonash/werbung_palmos.jpg";></A>
-------------------------------------------------------------------------


--
For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/

Reply via email to