Re: [PATCH] pnfs-obj: Uglify objio_segment allocation for the sake of the principle :-(

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

 



On Tue, Mar 13, 2012 at 8:44 PM, Boaz Harrosh <bharrosh@xxxxxxxxxxx> wrote:
> Since then any use of "variable length arrays" has become blasphemous.
> Even in perfectly good, beautiful, perfectly safe code like the one
> below where the variable length arrays are only used as a sizeof()
> parameter, for type-safe dynamic structure allocations. GCC is not
> executing any stack allocation code.

If it's a compile-time constant, just make it one. Stop the whining.
No VLA's required. You could, for example, make a trivial wrapper
macro that just declares that array as a constant array in the caller,
and it really *is* a constant sized array with no questions asked.

Instead, you waste more time and effort *whining* than doing that
technical solution.

You do realize that VLA's have caused real problems, since you even
quote some of the background. Not to mention all the problems they
cause for semantics analysis and static checkers.

VLA's really aren't a very good thing in the kernel. And the
work-around I suggest above is actually *simpler* than using them and
then spednign the effort explaining "but they are actually constants
at compile time after all, and aren't the bad kinds of VLAs".

Just don't do them. They are a mistake.

                  Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux