Keysmith in kdereview

Kevin Kofler kevin.kofler at chello.at
Thu Dec 19 00:58:56 GMT 2019


Albert Astals Cid wrote:
> I think it'd be good if you used a QVarLengthArray instead of "char
> code[m_pinLength];"

Sadly, QVarLengthArray is much less efficient, because it cannot do 
variable-size stack allocation, only fixed-size stack allocation (wasting 
stack space) and heap allocation for anything that does not fit (wasting the 
entire stack space and slowing down the application).

But unfortunately, it is the only thing that will compile on M$VC and other 
stubborn compilers that refuse to implement VLAs and whose developers have 
successfully sabotaged all attempts to bring this standardized C99 feature 
into the C++ standard (and even got C11 to make it optional for C too).

        Kevin Kofler





More information about the kde-core-devel mailing list