Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Jan 2021 12:25:05 +0100
From:      Hans Petter Selasky <hps@selasky.org>
To:        mmel@freebsd.org, src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   Re: git: bafb68265672 - main - Fix for off-by-one in GPIO driver after r368585. While at it declare the iteration variable outside the for-loop to appease older compilers.
Message-ID:  <91d89b94-0416-44b3-2a4c-3e64b7be5f28@selasky.org>
In-Reply-To: <1bbcc331-9a7a-f2d5-a71b-28e55ef32d40@freebsd.org>
References:  <202101130907.10D97J6M058131@gitrepo.freebsd.org> <1bbcc331-9a7a-f2d5-a71b-28e55ef32d40@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 1/13/21 12:13 PM, Michal Meloun wrote:
> 
> 
> On 13.01.2021 10:07, Hans Petter Selasky wrote:
>> The branch main has been updated by hselasky:
>>
>> URL: 
>> https://cgit.FreeBSD.org/src/commit/?id=bafb682656724d06045fa494efb83a4312036f1f 
>>
>>
>> commit bafb682656724d06045fa494efb83a4312036f1f
>> Author:     Hans Petter Selasky <hselasky@FreeBSD.org>
>> AuthorDate: 2021-01-12 17:46:09 +0000
>> Commit:     Hans Petter Selasky <hselasky@FreeBSD.org>
>> CommitDate: 2021-01-13 09:06:30 +0000
>>
>>      Fix for off-by-one in GPIO driver after r368585.
>>      While at it declare the iteration variable outside the for-loop
>>      to appease older compilers.
> 
> Why? All supported compilers are familiar with this variable 
> declaration. It is explicitly allowed by style (9) and makes the code 
> much more readable, IMHO.
> 

Hi,

Maybe I'm a bit old-fashioned, but it appears declaring variables inside 
for-loops is a C99 thing:

https://stackoverflow.com/questions/1287863/c-for-loop-int-initial-declaration

You are right, I didn't have to change that.

And btw, style(9) was updated:

commit 34a8e7368f3f00d4564b0b980871f73929d6b1ce
Author: Warner Losh <imp@FreeBSD.org>
Date:   Thu Jul 16 14:12:54 2020 +0000

And I didn't yet install that version :-)

I'll fix.

--HPS



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?91d89b94-0416-44b3-2a4c-3e64b7be5f28>