Mail Archives: djgpp-workers/2002/05/28/01:23:08
Martin Str|mberg wrote:
> According to CBFalconer:
>
> > To me a warning is just that. It says "I know just how to handle
> > this, but it is unusual and did you really mean it?". While, as
>
> What unusual about ``sprintf(s, "")´´? It a perfectly legal way to
> initialize s to an empty string.
>
> > you say, auto generated code can include such empty format
> > strings, I can think of no reason for human generated code to do
> > so, when it is most likely a typo.
>
> No. Why shouldn't I use the above command if I did want to do the
> above?
I can think of several better ways of initializing s to an empty
string. A poll of 100 C programmers asked to initialize an empty
string would probably not produce that coding once. And if you
really want to do it that way, you are perfectly free to ignore or
suppress the warning.
I have been bitten often enough by some sort of silly typo, which
is almost invisible to the naked eye and generates legal code that
doesn't do what I planned. The compiler is much better than I am
at spotting this sort of thing, and I am quite happy to let it
warn me about the occurences. Maybe it should warn about macros
with terminal semicolons too!
I certainly don't want to get into any sort of a war about it.
However I am entitled to my opinion, as you are to yours. IMNSHO
mine is better.
--
Chuck F (cbfalconer AT yahoo DOT com) (cbfalconer AT worldnet DOT att DOT net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
- Raw text -