lab0-c icon indicating copy to clipboard operation
lab0-c copied to clipboard

It can use VLA to bypass the memory allocating limit in q_sort()

Open asas1asas200 opened this issue 3 years ago • 1 comments

In q_sort(), it prefered to use a in-place algorithm to sort the list, so it disallowed the malloc() in some testcases.

But I can still use Variable-length array to bypass this limit, and use a algorithm which space complexity is O(n) to pass all testcases.

Is it a fatal problem?

asas1asas200 avatar Feb 27 '22 18:02 asas1asas200

@eecheng87, we can follow the way how Linux kernel removed VLA. That is, enforce compilation argument -Wvla.

jserv avatar Feb 28 '22 01:02 jserv