www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/05/28/01:23:08

Message-ID: <3CF2F3CC.B6EA5915@yahoo.com>
Date: Mon, 27 May 2002 23:04:44 -0400
From: CBFalconer <cbfalconer AT yahoo DOT com>
Organization: Ched Research
X-Mailer: Mozilla 4.75 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: Useless warning from gcc 3.1
References: <200205272056 DOT g4RKuTs16122 AT speedy DOT ludd DOT luth DOT se>
Reply-To: djgpp-workers AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019