This is the mail archive of the gdb-patches@sourceware.org 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: [patch-readline] history file reading


On Tue, Mar 21, 2006 at 10:33:08AM -0500, Bob Rossi wrote:
> On Tue, Mar 21, 2006 at 04:30:11PM +0100, Andreas Schwab wrote:
> > Daniel Jacobowitz <drow@false.org> writes:
> > 
> > >> +	if ( line_end - 1 >= line_start && *( line_end - 1 ) =='\r' )
> > >> +	  *( line_end - 1 )  = '\0';
> > >
> > > And you don't need the spaces inside the parentheses, but do usually
> > > need spaces around operators:
> > >
> > > 	if (line_end - 1 >= line_start && *(line_end - 1) == '\r')
> > > 	  *(line_end - 1)  = '\0';
> > 
> > line_end[-1] whould be much better readable, IMHO.
> 
> Can you even index into an array with a negitive number?

Certainly.  And I agree with Andreas (though not enough to go back and
change code someone else has written).

-- 
Daniel Jacobowitz
CodeSourcery


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