Re: [dev] [st] [PATCH 2/5] Replace for with while.

From: koneu <koneu93_AT_googlemail.com>
Date: Sun, 19 Apr 2015 10:23:59 +0200

On 04/18/2015 06:45 PM, noname wrote:
> ---
> st.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/st.c b/st.c
> index 3fa58da..30f296d 100644
> --- a/st.c
> +++ b/st.c
> _AT_@ -3930,8 +3930,9 @@ run(void) {
>
> clock_gettime(CLOCK_MONOTONIC, &last);
> lastblink = last;
> + xev = actionfps;
>
> - for(xev = actionfps;;) {
> + while(1) {
> FD_ZERO(&rfd);
> FD_SET(cmdfd, &rfd);
> FD_SET(xfd, &rfd);

As per "The C Programming Language 2nd Edition" and the BSD style guide,
the "proper" way to loop infinitely in C is "for(;;)".
I agree about moving the assignment out of the loop initialization
though. It is cleaner this way.
Received on Sun Apr 19 2015 - 10:23:59 CEST

This archive was generated by hypermail 2.3.0 : Sun Apr 19 2015 - 10:36:04 CEST