Well, we do know the max for all of the VLAs, so it would be trivial to change the code to use that value instead. However, for the sake of keeping the stack shallow on embedded systems, I would prefer to do this conditionally only if the C compiler doesn't support VLAs.
Does the W32-crowd know whether AC_C_VARARRAYS and the resulting __STDC_NO_VLA__ works nicely with Visual Studio? If so, we could #if __STDC_NO_VLA__ #define VLA_LEN_DIGEST(n) (32*2+1) #else #define VLA_LEN_DIGEST(n) (n) #endif and then use char buf[VLA_LEN_DIGEST(n)] instead of char buf[n] in the digestauth code. WDYT? -Christian On 12/10/18 9:53 AM, Tim Rühsen wrote: > Hi, > > instead of keeping all projects at C89, you can also use Visual Studio > with LLVM/Clang or GCC: > > https://blogs.msdn.microsoft.com/vcblog/2017/03/07/use-any-c-compiler-with-visual-studio/ > > I personally don't have any experiences with that (just don't have a MS > Windows license) but know people building C99 OSS on Windows with clang. > > > Regards, Tim > > On 12/8/18 11:32 PM, Jonathan McDougall wrote: >> This commit[1] made a lot of changes to digestauth.c, including using >> a bunch of VLAs, which are not supported in all compilers, one of which >> is Visual Studio. >> >> If you want to keep supporting Visual Studio, those will have to be >> arrays of constant size, or allocated on the heap. >> >> [1] >> https://gnunet.org/git/libmicrohttpd.git/commit/src/microhttpd/digestauth.c?id=bcba3f58c5fc9b4a3776494d3edddceb244ab110 >> >
signature.asc
Description: OpenPGP digital signature
