www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/05/26/12:05:03

Sender: rich AT phekda DOT freeserve DOT co DOT uk
Message-ID: <3CF107A3.4651AF3D@phekda.freeserve.co.uk>
Date: Sun, 26 May 2002 17:04:51 +0100
From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.19 i586)
X-Accept-Language: de,fr
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: refresh++
References: <200205261159 DOT g4QBxVO22330 AT speedy DOT ludd DOT luth DOT se>
Reply-To: djgpp-workers AT delorie DOT com

Hello.

Martin Str|mberg wrote:
[snip]
> Yes. Why (extremely strong expletive) is gcc complaining about
> perfectly legal and useful code.

It's actually trying to help us out. The warning is about the "zero-length
format string" we're passing to snprintf. It's only an error, because we're
compiling with -Werror now.
 
> The fact that libc happily changes their code to comply with broken
> gcc behaviour does not say much.
[snip]

IMHO using snprintf like this to truncate a string is overkill. Why not just
truncate it using "buf[0] = '\0';"?

Bye, Rich =]

-- 
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]

- Raw text -


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