This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] win32-nat printf and sprintf removal


On Thu, Feb 14, 2002 at 05:44:10PM +0100, Pierre Muller wrote:
>At 17:13 14/02/2002 , Christopher Faylor a ?crit:
>>On Thu, Feb 14, 2002 at 10:31:33AM -0500, Andrew Cagney wrote:
>> >Suggest adding a comment just above each sprintf() call indicating that
>> >buf is static (at least that way the next person won't be puzzled by
>> >this).
>>
>>There are three sprintfs in win32-nat.c.  One uses a static buffer of 80
>>bytes (which is overkill).  The 'static char buf[80]' is two or three
>>lines above the use of sprintf.  The other use of sprintf uses an
>>alloca'ed buffer.  The alloca is directly above the sprintf.
>>
>>I don't think it makes sense to mention "this buffer is static" one line
>>below the definition of the buffer or "this buffer is allocated from the
>>stack" directly after the buffer is allocated on the stack.
>>
>>The moral of the story here is not that more comments are needed (at
>>least not in this case).  The true moral is that you should be sensitive
>>to warnings in the code, you should be *very* sensitive to an increase
>>in warnings (in this case from zero to three) and you should test
>>changes thoroughly before submitting an "obvious" fix.
>
>You are completely right, I need to be more cautious,
>especially as my C knowledge still is quite lacunar.
>(I didn't know about the automatic disposal for alloca until today :()

No permanent harm done.  I *really* appreciate all the work that you're
doing on win32-nat.c.  You're adding features that I've been dreaming about
for years.

Which reminds me.  I have a patch pending that I really should apply.
It allows use of ">" "<" constructs from the command line.

Where did I put that patch?  Rustle, rustle...

cgf


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]