The warning is not a bogus error IMO. It's indeed true that variable length 
arrays are not part of the C++ standard. But both GCC and clang treat variable 
length arrays as C++ extensions. It's just that clang is choosing to warn about 
the use, while apparently GCC does not. There's probably a way to turn off the 
warnings in clang but I don't know if I'd bother.

Most of my (limnited) research on the subject discourages use of variable 
length arrays in C++ for several reasons. There are other constructs in C++ 
that are recommended in place of C-style variable length arrays.

From what I'm also reading, variable length array declarations of local 
variables is still an optional component of the C standard starting with C11. 

- Paul


> On Aug 15, 2025, at 4:12 PM, Blake McBride <blake1...@gmail.com> wrote:
> 
> If variable-length arrays are not supported by standard C++, why use them?  
> I'm sure you don't strictly need them, and by using them GNU-APL becomes 
> non-portable.
> 
> --blake
> 
> 
> 
> 
> On Fri, Aug 15, 2025 at 12:06 PM Dr. Jürgen Sauermann via Bugs and 
> suggestions for GNU APL <bug-apl@gnu.org <mailto:bug-apl@gnu.org>> wrote:
>> Hi Louis,
>> 
>> thanks, hopefully fixed in SVN 1880.
>> 
>> I believe I have caught most of the C++ warnings. The warning about
>> dynamic arrays is somewhat bogus since every C++ compiler that I know of
>> supports dynamic arrays event though they are not standardised in C++ (and
>> only god knows why not).
>> 
>> I haven't touched the ld warnings; it seems like these linker flags are 
>> needed on
>> some platforms. It might be that re-running libtoolize and/or aclocal gets 
>> rid of
>> these warnings.
>> 
>> Best Regards,
>> Jürgen
>> 
>> 
>> On 8/12/25 20:18, Louis Chretien wrote:
>>> Yes, it did. The build was successful despite the warnings. 
>>> 
>>> —
>>> Louis Chrétien
>>> lchret...@mac.com <mailto:lchret...@mac.com>
>>> 
>>>> On Aug 12, 2025, at 13:18, Dr. Jürgen Sauermann <mail@jürgen-sauermann.de> 
>>>> <mailto:mail@j%C3%BCrgen-sauermann.de> wrote:
>>>> 
>>>>  Hi Louis,
>>>> 
>>>> I will look into this. Did the build produce a working apl binary despite 
>>>> the warnings?
>>>> 
>>>> Thanks,
>>>> Jürgen
>>>> 
>>>> 
>>>> On 7/21/25 18:33, Louis Chretien via Bugs and suggestions for GNU APL 
>>>> wrote:
>>>>> There is a bunch of warnings on the latest build of GNU APL for Mac OS 
>>>>> 14.7.6:
>>>>> 
>>>>> ==============================
>>>>> 
>>>>> Backtrace.cc:1401:18: warning: variable length arrays in C++ are a Clang 
>>>>> extension [-Wvla-cxx-extension]
>>>>>  1401 |          char si[strlen(const_si) + 1];
>>>>>       |                  ^~~~~~~~~~~~~~~~~~~~
>>>>> Backtrace.cc:1401:25: note: read of non-constexpr variable 'const_si' is 
>>>>> not allowed in a constant expression
>>>>>  1401 |          char si[strlen(const_si) + 1];
>>>>>       |                         ^
>>>>> Backtrace.cc:1400:23: note: declared here
>>>>>  1400 |          const char * const_si = strings[size - i - 1];
>>>>>       |                       ^
>>>>> 1 warning generated.
>>>>> 
>>>>> Bif_F12_INDEX_OF.cc:75:22: warning: variable length arrays in C++ are a 
>>>>> Clang extension [-Wvla-cxx-extension]
>>>>>    75 |         ShapeItem zz[rk_Z];
>>>>>       |                      ^~~~
>>>>> Bif_F12_INDEX_OF.cc:75:22: note: initializer of 'rk_Z' is not a constant 
>>>>> expression
>>>>> Bif_F12_INDEX_OF.cc:70:13: note: declared here
>>>>>    70 | const sRank rk_Z = Z->get_rank();
>>>>>       |             ^
>>>>> 1 warning generated.
>>>>> 
>>>>> PrimitiveFunction.cc:538:20: warning: variable length arrays in C++ are a 
>>>>> Clang extension [-Wvla-cxx-extension]
>>>>>   538 | ShapeItem weight_Z[rank_Z];
>>>>>       |                    ^~~~~~
>>>>> PrimitiveFunction.cc:538:20: note: read of non-const variable 'rank_Z' is 
>>>>> not allowed in a constant expression
>>>>> PrimitiveFunction.cc:517:11: note: declared here
>>>>>   517 | ShapeItem rank_Z = 0;
>>>>>       |           ^
>>>>> 1 warning generated.
>>>>> 
>>>>> Quad_CR.cc:1143:16: warning: variable length arrays in C++ are a Clang 
>>>>> extension [-Wvla-cxx-extension]
>>>>>  1143 | UTF8 bytes_utf[len_B + 10];
>>>>>       |                ^~~~~~~~~~
>>>>> Quad_CR.cc:1143:16: note: initializer of 'len_B' is not a constant 
>>>>> expression
>>>>> Quad_CR.cc:1141:17: note: declared here
>>>>>  1141 | const ShapeItem len_B = B->element_count();
>>>>>       |                 ^
>>>>> Quad_CR.cc:1723:32: warning: variable 'bi' set but not used 
>>>>> [-Wunused-but-set-variable]
>>>>>  1723 |          if (const APL_Integer bi = cell_B.get_near_int())   
>>>>> chunk |= bit;
>>>>>       |                                ^
>>>>> 2 warnings generated.
>>>>> 
>>>>> Quad_DLX.cc:465:16: warning: variable length arrays in C++ are a Clang 
>>>>> extension [-Wvla-cxx-extension]
>>>>>   465 | char rows_used[rows];
>>>>>       |                ^~~~
>>>>> Quad_DLX.cc:465:16: note: implicit use of 'this' pointer is only allowed 
>>>>> within the evaluation of a call to a 'constexpr' member function
>>>>> Quad_DLX.cc:478:18: warning: variable length arrays in C++ are a Clang 
>>>>> extension [-Wvla-cxx-extension]
>>>>>   478 |          int row[cols];
>>>>>       |                  ^~~~
>>>>> Quad_DLX.cc:478:18: note: implicit use of 'this' pointer is only allowed 
>>>>> within the evaluation of a call to a 'constexpr' member function
>>>>> 2 warnings generated.
>>>>> 
>>>>> Tokenizer.cc:966:13: warning: variable length arrays in C++ are a Clang 
>>>>> extension [-Wvla-cxx-extension]
>>>>>   966 | char buffer[int_digits.size() + fract_digits.size() + 
>>>>> expo_digits.size() + 20];
>>>>>       |             
>>>>> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>> Tokenizer.cc:966:24: note: non-constexpr function 'size' cannot be used 
>>>>> in a constant expression
>>>>>   966 | char buffer[int_digits.size() + fract_digits.size() + 
>>>>> expo_digits.size() + 20];
>>>>>       |                        ^
>>>>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string:1284:65:
>>>>>  note: declared here
>>>>>  1284 |   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type 
>>>>> size() const _NOEXCEPT {
>>>>>       |                                                                 ^
>>>>> 1 warning generated.
>>>>> 
>>>>> UCS_string_vector.cc:228:25: warning: variable length arrays in C++ are a 
>>>>> Clang extension [-Wvla-cxx-extension]
>>>>>   228 | ShapeItem column_widths[column_count];
>>>>>       |                         ^~~~~~~~~~~~
>>>>> UCS_string_vector.cc:228:25: note: function parameter 'column_count' with 
>>>>> unknown value cannot be used in a constant expression
>>>>> UCS_string_vector.cc:225:59: note: declared here
>>>>>   225 | UCS_string_vector::print_table(std::ostream & out, size_t 
>>>>> column_count) const
>>>>>       |                                                           ^
>>>>> 1 warning generated.
>>>>> 
>>>>> UserFunction.cc:638:13: warning: variable length arrays in C++ are a 
>>>>> Clang extension [-Wvla-cxx-extension]
>>>>>   638 | char status[get_text_size()];   status[0] = Function_header;
>>>>>       |             ^~~~~~~~~~~~~~~
>>>>> UserFunction.cc:638:13: note: implicit use of 'this' pointer is only 
>>>>> allowed within the evaluation of a call to a 'constexpr' member function
>>>>> UserFunction.cc:731:13: warning: variable length arrays in C++ are a 
>>>>> Clang extension [-Wvla-cxx-extension]
>>>>>   731 | char status[get_text_size()];   status[0] = Function_header;
>>>>>       |             ^~~~~~~~~~~~~~~
>>>>> UserFunction.cc:731:13: note: implicit use of 'this' pointer is only 
>>>>> allowed within the evaluation of a call to a 'constexpr' member function
>>>>> UserFunction.cc:856:35: warning: variable 'ec' set but not used 
>>>>> [-Wunused-but-set-variable]
>>>>>   856 |               if (const ErrorCode ec = 
>>>>> transform_new_multi_lines())
>>>>>       |                                   ^
>>>>> UserFunction.cc:875:35: warning: variable 'ec' set but not used 
>>>>> [-Wunused-but-set-variable]
>>>>>   875 |               if (const ErrorCode ec = 
>>>>> transform_old_multi_lines())
>>>>>       |                                   ^
>>>>> UserFunction.cc:1414:24: warning: variable 'ec' set but not used 
>>>>> [-Wunused-but-set-variable]
>>>>>  1414 |    if (const ErrorCode ec = parser.parse(body_text, body, true))
>>>>>       |                        ^
>>>>> 5 warnings generated.
>>>>> 
>>>>> ==============================
>>>>> 
>>>>> Also, there is an option on the ld command that should probably be 
>>>>> removed in the makefile:
>>>>> 
>>>>> ==============================
>>>>> 
>>>>> checking for -single_module linker flag... ld: warning: -single_module is 
>>>>> obsolete
>>>>> no
>>>>> ld: warning: -bind_at_load is deprecated on macOS
>>>>> 
>>>>> ==============================
>>>>> 
>>>>> ---
>>>>> Louis Chrétien
>>>>> lchret...@mac.com <mailto:lchret...@mac.com>
>>>> 
>> 

  • MacOS: Bunch o... Louis Chretien via Bugs and suggestions for GNU APL
    • Re: MacOS... Louis Chretien
      • Re: M... Dr . Jürgen Sauermann via Bugs and suggestions for GNU APL
        • R... Blake McBride
          • ... Paul Rockwell
          • ... Robin Haberkorn

Reply via email to