[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gnulib] FYI: copy-file.c tweak

From: Bruno Haible
Subject: Re: [Bug-gnulib] FYI: copy-file.c tweak
Date: Mon, 28 Apr 2003 12:39:20 +0200 (CEST)

Paul Eggert writes:

> >   char buf[4096];
> >   const size_t buf_size = sizeof (buf);
> While we're on the subject, I find that 'const' to make the code less
> readable here.

For me, 'const' local variables are like better-behaved #defines.

> >   const size_t buf_size = MIN (MAX (file_size, 4096), 1048576);
> >   char *buf = (char *) xmalloc (buf_size);
> If you wanted to be truly consistent, you would write 'char * const buf'.

Agreed. And now this 'const' really confuses beginners :-)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]