Re: [PATCH] Remove VLA from fs/reiserfs/reiserfs.h

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

 



On Fri, 9 Mar 2018, Jan Kara wrote:
> On Fri 09-03-18 12:05:35, Thomas Gleixner wrote:
> > On Fri, 9 Mar 2018, Jan Kara wrote:
> > 
> > > Hum, what is 'VLA'?
> > 
> > Variable Length Array. They are allocated on stack and sized at runtime.
> > Those are bad for obvious reasons and should have never been allowed in C
> > in the first place. clang does not support them for really good reasons.
> > 
> > > And why do we want to replace easy to understand strlen() with sizeof()
> > > where I had to think and actually look up what the C standard says about
> > > a sizeof(string literal).
> > 
> > The issue is, that strlen() results in actual runtime evaluation instead of
> > the compiler being clever and figuring out that it is a compile time
> > constant. And runtime evaluation creates a VLA. 
> > 
> > Using sizeof() forces the compiler to evaluate it at compile time, so it's
> > just a compile time sized array on stack.
> 
> Ah, thanks for explanation! Now the patch makes much more sense :). I'll
> cut-n-paste your explanation to the patch changelog and take it to my tree.

Yeah, the changelog should have had this information in the first
place. Unfortunately most changelogs just suck.

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



[Index of Archives]     [Linux File System Development]     [Linux BTRFS]     [Linux NFS]     [Linux Filesystems]     [Ext4 Filesystem]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Resources]

  Powered by Linux