• argument array sizes in methods

    From Lynn McGuire@3:633/10 to All on Thu May 21 18:46:53 2026
    How come I cannot do this in argument arrays in C++ ?

    int sicmct (const longint nprint, longint nprara [nprint])

    longint is just a long long.

    Thanks,
    Lynn


    --- PyGate Linux v1.5.14
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Keith Thompson@3:633/10 to All on Thu May 21 17:39:27 2026
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    How come I cannot do this in argument arrays in C++ ?

    int sicmct (const longint nprint, longint nprara [nprint])

    Because C++ does not support variable-length array types.

    longint is just a long long.

    Just an observation: that's a really poorly chosen name. I would
    have assumed that "longint" means "long int" (and wondered why
    the code doesn't just use "long int" or "long" directly). I don't
    necessarily object to having at typedef for long long, but its name
    should be meaningful.

    --
    Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
    void Void(void) { Void(); } /* The recursive call of the void */

    --- PyGate Linux v1.5.14
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lynn McGuire@3:633/10 to All on Thu May 21 22:17:07 2026
    On 5/21/2026 7:39 PM, Keith Thompson wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    How come I cannot do this in argument arrays in C++ ?

    int sicmct (const longint nprint, longint nprara [nprint])

    Because C++ does not support variable-length array types.

    longint is just a long long.

    Just an observation: that's a really poorly chosen name. I would
    have assumed that "longint" means "long int" (and wondered why
    the code doesn't just use "long int" or "long" directly). I don't necessarily object to having at typedef for long long, but its name
    should be meaningful.

    So, to get the length of the array passed to a debugger, I would need to
    use std::array or std::vector?

    F2C chose that longint name for me and I was too lazy to change it. It
    is a distinctive name which I like.

    Yup, you are correct, it is a typedef.

    typedef long long longint;

    Lynn


    --- PyGate Linux v1.5.14
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Keith Thompson@3:633/10 to All on Thu May 21 21:03:34 2026
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    On 5/21/2026 7:39 PM, Keith Thompson wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    How come I cannot do this in argument arrays in C++ ?

    int sicmct (const longint nprint, longint nprara [nprint])

    Because C++ does not support variable-length array types.

    longint is just a long long.

    Just an observation: that's a really poorly chosen name. I would
    have assumed that "longint" means "long int" (and wondered why
    the code doesn't just use "long int" or "long" directly). I don't
    necessarily object to having at typedef for long long, but its name
    should be meaningful.

    So, to get the length of the array passed to a debugger, I would need
    to use std::array or std::vector?

    The length of a std::array has to be a constant expression.
    std::vector is likely to be a good choice for this kind of thing,
    but obviously Fortran doesn't have std::vector.

    You could also (in either C or C++) do something like

    int sicmct(const longint len, longint *nprara)

    and rely on the caller to ensure that nprara points to the first
    element of an array with at least len elements.

    As I understand it, f2c generates C code by default. It has a
    "-C++" option to tell it to generate C++ code. Presumably it
    wouldn't generate the above code with the "-C++" option.

    Can you (briefly) show the Fortran code that you fed to f2c?
    How does the "-C++" option affect the generated code?

    F2C chose that longint name for me and I was too lazy to change it.
    It is a distinctive name which I like.

    Yup, you are correct, it is a typedef.

    typedef long long longint;

    Style issues are less important in machine-generated code -- unless
    the generated code is intended to be maintained. Is it intended to
    match some Fortran type?

    --
    Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
    void Void(void) { Void(); } /* The recursive call of the void */

    --- PyGate Linux v1.5.14
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lynn McGuire@3:633/10 to All on Fri May 22 00:30:09 2026
    On 5/21/2026 11:03 PM, Keith Thompson wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    On 5/21/2026 7:39 PM, Keith Thompson wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    How come I cannot do this in argument arrays in C++ ?

    int sicmct (const longint nprint, longint nprara [nprint])

    Because C++ does not support variable-length array types.

    longint is just a long long.

    Just an observation: that's a really poorly chosen name. I would
    have assumed that "longint" means "long int" (and wondered why
    the code doesn't just use "long int" or "long" directly). I don't
    necessarily object to having at typedef for long long, but its name
    should be meaningful.

    So, to get the length of the array passed to a debugger, I would need
    to use std::array or std::vector?

    The length of a std::array has to be a constant expression.
    std::vector is likely to be a good choice for this kind of thing,
    but obviously Fortran doesn't have std::vector.

    You could also (in either C or C++) do something like

    int sicmct(const longint len, longint *nprara)

    and rely on the caller to ensure that nprara points to the first
    element of an array with at least len elements.

    As I understand it, f2c generates C code by default. It has a
    "-C++" option to tell it to generate C++ code. Presumably it
    wouldn't generate the above code with the "-C++" option.

    Can you (briefly) show the Fortran code that you fed to f2c?
    How does the "-C++" option affect the generated code?

    F2C chose that longint name for me and I was too lazy to change it.
    It is a distinctive name which I like.

    Yup, you are correct, it is a typedef.

    typedef long long longint;

    Style issues are less important in machine-generated code -- unless
    the generated code is intended to be maintained. Is it intended to
    match some Fortran type?

    I customized F2C to meet my needs and likes. I am moving my 800,000
    lines of F66/F77 to C++ for my calculation engine which also has 50,000
    lines of C++ code. F2C does a great job on ints and doubles. F2C does
    a terrible job on character strings and output.

    Lynn


    --- PyGate Linux v1.5.14
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lynn McGuire@3:633/10 to All on Fri May 22 00:32:59 2026
    On 5/21/2026 11:03 PM, Keith Thompson wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    On 5/21/2026 7:39 PM, Keith Thompson wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    How come I cannot do this in argument arrays in C++ ?

    int sicmct (const longint nprint, longint nprara [nprint])

    Because C++ does not support variable-length array types.

    longint is just a long long.

    Just an observation: that's a really poorly chosen name. I would
    have assumed that "longint" means "long int" (and wondered why
    the code doesn't just use "long int" or "long" directly). I don't
    necessarily object to having at typedef for long long, but its name
    should be meaningful.

    So, to get the length of the array passed to a debugger, I would need
    to use std::array or std::vector?

    The length of a std::array has to be a constant expression.
    std::vector is likely to be a good choice for this kind of thing,
    but obviously Fortran doesn't have std::vector.

    You could also (in either C or C++) do something like

    int sicmct(const longint len, longint *nprara)

    and rely on the caller to ensure that nprara points to the first
    element of an array with at least len elements.

    As I understand it, f2c generates C code by default. It has a
    "-C++" option to tell it to generate C++ code. Presumably it
    wouldn't generate the above code with the "-C++" option.

    Can you (briefly) show the Fortran code that you fed to f2c?
    How does the "-C++" option affect the generated code?

    SUBROUTINE SICMCT (PRILOG, NPRINT, NPRARA)
    INCLUDE 'dii.inc'
    integer*8 i
    integer*8 jk
    logical*8 PRILOG (24)
    integer*8 NPRINT
    integer*8 NPRARA (NPRINT)
    DO I = 1, NPRINT
    JK = NPRARA(I)
    PRILOG(JK) = .FALSE.
    END DO
    RETURN
    END

    int sicmct (logical8 prilog [24], const longint nprint, const longint
    nprara [/*nprint*/])
    {
    longint i8__1;
    longint i, jk;

    i8__1 = nprint;
    for (i = 1; i <= i8__1; ++i) {
    jk = nprara[i - 1];
    prilog[jk - 1] = false;
    }
    return 0;
    } /* sicmct */

    Lynn


    --- PyGate Linux v1.5.14
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Bonita Montero@3:633/10 to All on Fri May 22 08:29:01 2026
    Am 22.05.2026 um 02:39 schrieb Keith Thompson:

    Because C++ does not support variable-length array types.

    But you can easily do that with addtional Posix means which are
    also available under Windows.

    span<int> spi( (int *)alloca( n * sizeof( int ) ), n );

    Doing that this way you can have bounds checking while debugging.

    Just an observation: that's a really poorly chosen name. ...

    The name is phantastic, I would suggest a Turing award for that.


    --- PyGate Linux v1.5.14
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From boltar@3:633/10 to All on Fri May 22 09:16:53 2026
    On Thu, 21 May 2026 17:39:27 -0700
    Keith Thompson <Keith.S.Thompson+u@gmail.com> gabbled:
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    How come I cannot do this in argument arrays in C++ ?

    int sicmct (const longint nprint, longint nprara [nprint])

    Because C++ does not support variable-length array types.

    Depends what you mean by support. As a basic compiler function no, but there's a reason realloc() exists.


    --- PyGate Linux v1.5.14
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Scott Lurndal@3:633/10 to All on Fri May 22 14:14:58 2026
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    On 5/21/2026 7:39 PM, Keith Thompson wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    How come I cannot do this in argument arrays in C++ ?

    int sicmct (const longint nprint, longint nprara [nprint])

    Because C++ does not support variable-length array types.

    longint is just a long long.

    Just an observation: that's a really poorly chosen name. I would
    have assumed that "longint" means "long int" (and wondered why
    the code doesn't just use "long int" or "long" directly). I don't
    necessarily object to having at typedef for long long, but its name
    should be meaningful.

    So, to get the length of the array passed to a debugger, I would need to
    use std::array or std::vector?

    Surely the length of the array is 'nprint', so 'simmct' (a rather poor
    name choice) already knows the length of the array.

    The preference with C++ would be to use one of the standard C++
    library data types, as you note.


    F2C chose that longint name for me and I was too lazy to change it. It
    is a distinctive name which I like.

    Yup, you are correct, it is a typedef.

    typedef long long longint;

    I agree with Keith, it's a rather poor choice of name.


    --- PyGate Linux v1.5.14
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lynn McGuire@3:633/10 to All on Fri May 22 15:20:48 2026
    On 5/22/2026 9:14 AM, Scott Lurndal wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    On 5/21/2026 7:39 PM, Keith Thompson wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    How come I cannot do this in argument arrays in C++ ?

    int sicmct (const longint nprint, longint nprara [nprint])

    Because C++ does not support variable-length array types.

    longint is just a long long.

    Just an observation: that's a really poorly chosen name. I would
    have assumed that "longint" means "long int" (and wondered why
    the code doesn't just use "long int" or "long" directly). I don't
    necessarily object to having at typedef for long long, but its name
    should be meaningful.

    So, to get the length of the array passed to a debugger, I would need to
    use std::array or std::vector?

    Surely the length of the array is 'nprint', so 'simmct' (a rather poor
    name choice) already knows the length of the array.

    Simmct was named back in 1975 or so when we did our software development
    on the Univac 1108 at University Computing Company (UCC). All variables
    and subroutine names in Fortran were limited to 6 upper case characters
    at that time. Because, the Univac was a 36 bit, 6 bit byte machine.

    My dad got free usage on the Univac 1108 in the Holcomb Bank building in Houston from 1970 to 1973 from midnight to 6 am. I can remember dad
    loading 16 ??? nine track tape drives to run the software that he, Gary,
    and Frank were writing. I would go along on non school nights and play
    Lunar Lander on the operator console until dad had to mount a tape or
    start the program.

    Lynn


    --- PyGate Linux v1.5.14
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Scott Lurndal@3:633/10 to All on Fri May 22 21:11:15 2026
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    On 5/22/2026 9:14 AM, Scott Lurndal wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    On 5/21/2026 7:39 PM, Keith Thompson wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    How come I cannot do this in argument arrays in C++ ?

    int sicmct (const longint nprint, longint nprara [nprint])

    Because C++ does not support variable-length array types.

    longint is just a long long.

    Just an observation: that's a really poorly chosen name. I would
    have assumed that "longint" means "long int" (and wondered why
    the code doesn't just use "long int" or "long" directly). I don't
    necessarily object to having at typedef for long long, but its name
    should be meaningful.

    So, to get the length of the array passed to a debugger, I would need to >>> use std::array or std::vector?

    Surely the length of the array is 'nprint', so 'simmct' (a rather poor
    name choice) already knows the length of the array.

    Simmct was named back in 1975 or so when we

    When you were 14?

    did our software development
    on the Univac 1108 at University Computing Company (UCC). All variables
    and subroutine names in Fortran were limited to 6 upper case characters
    at that time.

    That was, of course a half century ago. The state of the art has
    progressed somewhat since then, including limits on identifier sizes.

    If you're rewriting in a new language. a simple global search and
    replace will easily update those six-character names to something
    that actually aids readability rather than obscuring it.


    Because, the Univac was a 36 bit, 6 bit byte machine.

    Indeed, I worked for the company that still produces and
    supports the Sperry 2200 systems for more than a decade
    (albeit on the Burroughs side of Unisys).

    The actual reason that the Fortran compiler supported only
    six uppercase letter&digit identifiers was because that
    was what the Fortran IV standard (1966) required.

    --- PyGate Linux v1.5.14
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lynn McGuire@3:633/10 to All on Fri May 22 16:45:26 2026
    On 5/22/2026 4:11 PM, Scott Lurndal wrote:
    ...
    Simmct was named back in 1975 or so when we

    When you were 14?

    did our software development
    on the Univac 1108 at University Computing Company (UCC). All variables
    and subroutine names in Fortran were limited to 6 upper case characters
    at that time.

    That was, of course a half century ago. The state of the art has
    progressed somewhat since then, including limits on identifier sizes.

    If you're rewriting in a new language. a simple global search and
    replace will easily update those six-character names to something
    that actually aids readability rather than obscuring it.


    Because, the Univac was a 36 bit, 6 bit byte machine.

    Indeed, I worked for the company that still produces and
    supports the Sperry 2200 systems for more than a decade
    (albeit on the Burroughs side of Unisys).

    The actual reason that the Fortran compiler supported only
    six uppercase letter&digit identifiers was because that
    was what the Fortran IV standard (1966) required.

    Par Janson wrote simmct.f in 1975, not me. There have been over a
    hundred programmers of this software since 1965 or so. I started
    learning Fortran in June of 1975 when I was 14, yes, as a key puncher
    for SunFu Yang.

    I have over 5,000 Fortran subroutines with 800,000 lines of code. The
    last thing that I am going to do is willy nilly rename them all.
    Continuity is a good thing.

    My software is at version 16.27a, I am working on version 17.00 now. I
    have the source code for every version going back to version 8.03. To
    just rename everything would confuse things.

    One needs to be careful in life. Conversion from Fortran to C++ is
    enough of a change for today.

    Lynn


    --- PyGate Linux v1.5.14
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lynn McGuire@3:633/10 to All on Sun May 24 18:45:45 2026
    On 5/22/2026 4:45 PM, Lynn McGuire wrote:
    On 5/22/2026 4:11 PM, Scott Lurndal wrote:
    ...
    Simmct was named back in 1975 or so when we

    When you were 14?

    did our software development
    on the Univac 1108 at University Computing Company (UCC).ÿ All variables >>> and subroutine names in Fortran were limited to 6 upper case characters
    at that time.

    That was, of course a half century ago.ÿ The state of the art has
    progressed somewhat since then, including limits on identifier sizes.

    If you're rewriting in a new language. a simple global search and
    replace will easily update those six-character names to something
    that actually aids readability rather than obscuring it.


    Because, the Univac was a 36 bit, 6 bit byte machine.

    Indeed, I worked for the company that still produces and
    supports the Sperry 2200 systems for more than a decade
    (albeit on the Burroughs side of Unisys).

    The actual reason that the Fortran compiler supported only
    six uppercase letter&digit identifiers was because that
    was what the Fortran IV standard (1966) required.

    Par Janson wrote simmct.f in 1975, not me.ÿ There have been over a
    hundred programmers of this software since 1965 or so.ÿ I started
    learning Fortran in June of 1975 when I was 14, yes, as a key puncher
    for SunFu Yang.

    I have over 5,000 Fortran subroutines with 800,000 lines of code.ÿ The
    last thing that I am going to do is willy nilly rename them all.
    Continuity is a good thing.

    My software is at version 16.27a, I am working on version 17.00 now.ÿ I
    have the source code for every version going back to version 8.03.ÿ To
    just rename everything would confuse things.

    One needs to be careful in life.ÿ Conversion from Fortran to C++ is
    enough of a change for today.

    Lynn

    Make that version 16.27b. I just fixed PMR #6523 for a customer in
    California which was related to PMR #6090 from 2014 for a customer in
    France. An engineer programmer's job is never done.

    Lynn


    --- PyGate Linux v1.5.14
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lynn McGuire@3:633/10 to All on Wed May 27 17:08:50 2026
    On 5/21/2026 7:39 PM, Keith Thompson wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    How come I cannot do this in argument arrays in C++ ?

    int sicmct (const longint nprint, longint nprara [nprint])

    Because C++ does not support variable-length array types.

    So my C++ compiler likes

    int sicmct (const longint nprint, longint nprara [96])

    or

    int sicmct (const longint nprint, longint nprara [])

    So I guess that anything else is classified as variable that is not
    typed as const int and initialized.

    Lynn


    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lynn McGuire@3:633/10 to All on Wed May 27 17:18:43 2026
    On 5/27/2026 5:08 PM, Lynn McGuire wrote:
    On 5/21/2026 7:39 PM, Keith Thompson wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    How come I cannot do this in argument arrays in C++ ?

    int sicmct (const longint nprint, longint nprara [nprint])

    Because C++ does not support variable-length array types.

    So my C++ compiler likes

    ÿÿ int sicmct (const longint nprint, longint nprara [96])

    or

    ÿÿ int sicmct (const longint nprint, longint nprara [])

    So I guess that anything else is classified as variable that is not
    typed as const int and initialized.

    Lynn

    BTW, at least my compiler takes this:

    int sicmct (const longint nprint, longint nprara [4 * 96])

    Lynn


    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Scott Lurndal@3:633/10 to All on Wed May 27 22:52:21 2026
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    On 5/27/2026 5:08 PM, Lynn McGuire wrote:
    On 5/21/2026 7:39 PM, Keith Thompson wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    How come I cannot do this in argument arrays in C++ ?

    int sicmct (const longint nprint, longint nprara [nprint])

    Because C++ does not support variable-length array types.

    So my C++ compiler likes

    ÿÿ int sicmct (const longint nprint, longint nprara [96])

    or

    ÿÿ int sicmct (const longint nprint, longint nprara [])

    So I guess that anything else is classified as variable that is not
    typed as const int and initialized.

    Lynn

    BTW, at least my compiler takes this:

    int sicmct (const longint nprint, longint nprara [4 * 96])

    The compiler likely simply ignores the value in square brackets since
    it is effectively meaningless in C/C++.

    It would be helpful if you told us _which_ C++ compiler
    you're using, which options you provide to the compiler when
    using it, and any #pragmas you use to disable warnings and errors.

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From James Kuyper@3:633/10 to All on Wed May 27 19:52:36 2026
    On 2026-05-27 18:08, Lynn McGuire wrote:
    On 5/21/2026 7:39 PM, Keith Thompson wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    How come I cannot do this in argument arrays in C++ ?

    int sicmct (const longint nprint, longint nprara [nprint])

    Because C++ does not support variable-length array types.

    So my C++ compiler likes

    int sicmct (const longint nprint, longint nprara [96])

    Of course - 96 is an integer constant expression, which is allowed in
    array declarations, and ignored if the array is declared as a function parameter - that declaration is treated as the equivalent of "longint
    *npara". Those rules are the same in both C and C++.
    Now,. some expressions count as integer constant expressions in C++ that
    only count as integer expressions in C. In general, an array declaration
    that had one of those expressions for the array length would make that
    array a variable length array in C. However, in a function parameter declaration the length simply gets ignored as a result of being
    converted to a pointer declaration.

    or

    int sicmct (const longint nprint, longint nprara [])

    Since the integer constant expression is unnecessary, it can be left out
    - that declaration is also equivalent to "longint *npara".

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Keith Thompson@3:633/10 to All on Wed May 27 17:33:06 2026
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    On 5/21/2026 7:39 PM, Keith Thompson wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    How come I cannot do this in argument arrays in C++ ?

    int sicmct (const longint nprint, longint nprara [nprint])
    Because C++ does not support variable-length array types.

    So my C++ compiler likes

    int sicmct (const longint nprint, longint nprara [96])

    or

    int sicmct (const longint nprint, longint nprara [])

    Right, those are exactly equivalent. (And BTW, the "const" on the
    first parameter affects only the parameter object within the body
    of the function; it doesn't mean anything to callers.)

    A parameter of array type, with or without a constant length,
    is adjusted to the corresponding pointer type, so these are all
    exactly equivalent (both in C and in C++):

    int sicmct (const longint nprint, longint nprara [96])
    int sicmct (const longint nprint, longint nprara [])
    int sicmct (const longint nprint, longint *nprara)

    Yes, the 96 is quietly ignored. Yes, this is annoying. (C99 added
    a use of "static" on array parameters, but this is comp.lang.c++
    so I won't go into the details.()

    So I guess that anything else is classified as variable that is not
    typed as const int and initialized.

    It depends on what you mean by "anything else" -- and I have no idea
    what you mean by "that is not typed as const int and initialized".

    In C++, if there's an expression between the [], it has to be a
    *constant*, not const, expression. ("Constant" means, roughly,
    evaluated at compile time; "const" means read-only. Despite the
    obvious relationship of the terms, they're very different things.
    For example, `const int r = rand();` is perfectly valid.)

    As James Kuyper pointed out elsethread, there are some expressions
    that are constant expressions in C++ but not in C. For example,
    given
    const int answer = 42;
    the expression `answer` is a constant expression in C++, but not
    in C. But that doesn't seem to be relevant to the current case.

    Finally, a comment on the name "longint". You mentioned upthread
    that it's an alias (presumably a typedef) for long long. Anyone
    reading the code who doesn't already know that will almost certainly
    assume that it's a typedef for long, not for long long. The name
    "longint" is not just uninformative; it's actively misleading.

    If you want a name that suggests an integer type wider than int,
    consider something like "wideint".

    You said f2c chose the name "longint" for you. Can you provide a
    *small* snippet of Fortran code that demonstrates that?

    --
    Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
    void Void(void) { Void(); } /* The recursive call of the void */

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lynn McGuire@3:633/10 to All on Wed May 27 20:40:51 2026
    On 5/27/2026 5:52 PM, Scott Lurndal wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    On 5/27/2026 5:08 PM, Lynn McGuire wrote:
    On 5/21/2026 7:39 PM, Keith Thompson wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    How come I cannot do this in argument arrays in C++ ?

    int sicmct (const longint nprint, longint nprara [nprint])

    Because C++ does not support variable-length array types.

    So my C++ compiler likes

    ÿÿ int sicmct (const longint nprint, longint nprara [96])

    or

    ÿÿ int sicmct (const longint nprint, longint nprara [])

    So I guess that anything else is classified as variable that is not
    typed as const int and initialized.

    Lynn

    BTW, at least my compiler takes this:

    int sicmct (const longint nprint, longint nprara [4 * 96])

    The compiler likely simply ignores the value in square brackets since
    it is effectively meaningless in C/C++.

    It would be helpful if you told us _which_ C++ compiler
    you're using, which options you provide to the compiler when
    using it, and any #pragmas you use to disable warnings and errors.

    Microsoft Visual C++ 2015, 32 bit win32, debug code, no pragmas, no
    special options.

    Lynn


    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lynn McGuire@3:633/10 to All on Wed May 27 20:42:56 2026
    On 5/27/2026 7:33 PM, Keith Thompson wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    On 5/21/2026 7:39 PM, Keith Thompson wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    How come I cannot do this in argument arrays in C++ ?

    int sicmct (const longint nprint, longint nprara [nprint])
    Because C++ does not support variable-length array types.

    So my C++ compiler likes

    int sicmct (const longint nprint, longint nprara [96])

    or

    int sicmct (const longint nprint, longint nprara [])

    Right, those are exactly equivalent. (And BTW, the "const" on the
    first parameter affects only the parameter object within the body
    of the function; it doesn't mean anything to callers.)

    A parameter of array type, with or without a constant length,
    is adjusted to the corresponding pointer type, so these are all
    exactly equivalent (both in C and in C++):

    int sicmct (const longint nprint, longint nprara [96])
    int sicmct (const longint nprint, longint nprara [])
    int sicmct (const longint nprint, longint *nprara)

    Yes, the 96 is quietly ignored. Yes, this is annoying. (C99 added
    a use of "static" on array parameters, but this is comp.lang.c++
    so I won't go into the details.()

    So I guess that anything else is classified as variable that is not
    typed as const int and initialized.

    It depends on what you mean by "anything else" -- and I have no idea
    what you mean by "that is not typed as const int and initialized".

    In C++, if there's an expression between the [], it has to be a
    *constant*, not const, expression. ("Constant" means, roughly,
    evaluated at compile time; "const" means read-only. Despite the
    obvious relationship of the terms, they're very different things.
    For example, `const int r = rand();` is perfectly valid.)

    As James Kuyper pointed out elsethread, there are some expressions
    that are constant expressions in C++ but not in C. For example,
    given
    const int answer = 42;
    the expression `answer` is a constant expression in C++, but not
    in C. But that doesn't seem to be relevant to the current case.

    Finally, a comment on the name "longint". You mentioned upthread
    that it's an alias (presumably a typedef) for long long. Anyone
    reading the code who doesn't already know that will almost certainly
    assume that it's a typedef for long, not for long long. The name
    "longint" is not just uninformative; it's actively misleading.

    If you want a name that suggests an integer type wider than int,
    consider something like "wideint".

    You said f2c chose the name "longint" for you. Can you provide a
    *small* snippet of Fortran code that demonstrates that?

    integer*8 i

    Lynn


    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lynn McGuire@3:633/10 to All on Wed May 27 20:47:14 2026
    On 5/27/2026 6:52 PM, James Kuyper wrote:
    On 2026-05-27 18:08, Lynn McGuire wrote:
    On 5/21/2026 7:39 PM, Keith Thompson wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    How come I cannot do this in argument arrays in C++ ?

    int sicmct (const longint nprint, longint nprara [nprint])

    Because C++ does not support variable-length array types.

    So my C++ compiler likes

    int sicmct (const longint nprint, longint nprara [96])

    Of course - 96 is an integer constant expression, which is allowed in
    array declarations, and ignored if the array is declared as a function parameter - that declaration is treated as the equivalent of "longint *npara". Those rules are the same in both C and C++.
    Now,. some expressions count as integer constant expressions in C++ that
    only count as integer expressions in C. In general, an array declaration
    that had one of those expressions for the array length would make that
    array a variable length array in C. However, in a function parameter declaration the length simply gets ignored as a result of being
    converted to a pointer declaration.

    or

    int sicmct (const longint nprint, longint nprara [])

    Since the integer constant expression is unnecessary, it can be left out
    - that declaration is also equivalent to "longint *npara".

    I am really hoping that the debugger will use that [96] to know how much
    an array to show me in quickwatch.

    Otherwise it is a good hint for the next programmer that deals with this
    code.

    Lynn


    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lynn McGuire@3:633/10 to All on Wed May 27 20:52:05 2026
    On 5/27/2026 8:40 PM, Lynn McGuire wrote:
    On 5/27/2026 5:52 PM, Scott Lurndal wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    On 5/27/2026 5:08 PM, Lynn McGuire wrote:
    On 5/21/2026 7:39 PM, Keith Thompson wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    How come I cannot do this in argument arrays in C++ ?

    int sicmct (const longint nprint, longint nprara [nprint])

    Because C++ does not support variable-length array types.

    So my C++ compiler likes

    ÿ ÿÿ int sicmct (const longint nprint, longint nprara [96])

    or

    ÿ ÿÿ int sicmct (const longint nprint, longint nprara [])

    So I guess that anything else is classified as variable that is not
    typed as const int and initialized.

    Lynn

    BTW, at least my compiler takes this:

    ÿÿÿ int sicmct (const longint nprint, longint nprara [4 * 96])

    The compiler likely simply ignores the value in square brackets since
    it is effectively meaningless in C/C++.

    It would be helpful if you told us _which_ C++ compiler
    you're using, which options you provide to the compiler when
    using it, and any #pragmas you use to disable warnings and errors.

    Microsoft Visual C++ 2015, 32 bit win32, debug code, no pragmas, no
    special options.

    Lynn

    And I am creating a very large Win32 DLL with this code. When I get it
    to working, I will then create a very large Win64 DLL with the code. I
    will have to ship both since several of my customers are using the
    current Win32 DLL. I have customers waiting for the Win64 DLL that will
    be callable from Excel x64.

    Lynn


    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Keith Thompson@3:633/10 to All on Wed May 27 19:17:46 2026
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    [...]
    You said f2c chose the name "longint" for you. Can you provide a
    *small* snippet of Fortran code that demonstrates that?

    integer*8 i

    OK, thanks.

    On my system (Ubuntu), the generated C code has `#include "f2c.h"`,
    which is in /usr/include/f2c.h, which is provided by the
    libf2c2-dev:amd64 package.

    I had to add an "end" statement and an assignment to i to get the type
    to show up in the generated C code. Fortran:

    integer*8 i
    i = 42
    end

    Generated C:

    #include "f2c.h"
    // ...
    static longint i__;

    i__ = 42;
    // ...

    The f2c.h file has:

    #ifdef INTEGER_STAR_8 /* Adjust for integer*8. */
    typedef int64_t longit;
    typedef uint64_t ulongint;
    ...

    So "longint" is only indirectly an alias for long long, via
    "int64_t". And presumably the intent is that C is being used as
    an intermediate language, not meant to be maintained. (Defining
    consistent names for integer types across languages can be tricky.)

    And there's an astonishing typo ("longit" rather than "longint"),
    which I can't find in any f2c source code, but it appears in versions 20200916-1 (Ubuntu 24.04.4) and 20240504-1build1 (Ubuntu 26.04).

    This is almost entirely off-topic for comp.lang.c.

    --
    Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
    void Void(void) { Void(); } /* The recursive call of the void */

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Keith Thompson@3:633/10 to All on Wed May 27 19:18:19 2026
    Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
    [...]
    This is almost entirely off-topic for comp.lang.c.

    And of course for comp.lang.c++, which is what I meant to type.

    --
    Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
    void Void(void) { Void(); } /* The recursive call of the void */

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lynn McGuire@3:633/10 to All on Wed May 27 21:42:57 2026
    On 5/27/2026 9:17 PM, Keith Thompson wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    [...]
    You said f2c chose the name "longint" for you. Can you provide a
    *small* snippet of Fortran code that demonstrates that?

    integer*8 i

    OK, thanks.

    On my system (Ubuntu), the generated C code has `#include "f2c.h"`,
    which is in /usr/include/f2c.h, which is provided by the
    libf2c2-dev:amd64 package.

    I had to add an "end" statement and an assignment to i to get the type
    to show up in the generated C code. Fortran:

    integer*8 i
    i = 42
    end

    Generated C:

    #include "f2c.h"
    // ...
    static longint i__;

    i__ = 42;
    // ...

    The f2c.h file has:

    #ifdef INTEGER_STAR_8 /* Adjust for integer*8. */
    typedef int64_t longit;
    typedef uint64_t ulongint;
    ...

    So "longint" is only indirectly an alias for long long, via
    "int64_t". And presumably the intent is that C is being used as
    an intermediate language, not meant to be maintained. (Defining
    consistent names for integer types across languages can be tricky.)

    And there's an astonishing typo ("longit" rather than "longint"),
    which I can't find in any f2c source code, but it appears in versions 20200916-1 (Ubuntu 24.04.4) and 20240504-1build1 (Ubuntu 26.04).

    This is almost entirely off-topic for comp.lang.c.

    I have heavily modified f2c for my needs and to generate C++ code.

    Thanks,
    Lynn


    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chris M. Thomasson@3:633/10 to All on Wed May 27 19:45:28 2026
    On 5/27/2026 6:42 PM, Lynn McGuire wrote:
    [...]
    You said f2c chose the name "longint" for you.ÿ Can you provide a
    *small* snippet of Fortran code that demonstrates that?

    ÿÿÿÿÿ integer*8 i

    Shit man, that can make me think of integer*8 + 0i

    integer, how large does it fit with a word on the system? I don't know.

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chris M. Thomasson@3:633/10 to All on Wed May 27 19:46:44 2026
    On 5/27/2026 6:40 PM, Lynn McGuire wrote:
    [...]
    Microsoft Visual C++ 2015, 32 bit win32, debug code, no pragmas, no
    special options.

    Fwiw, I used the live shit out of the compiler! Pretty good with C, C++
    okay. Its fun that MSVC used to have better support for C than C++.

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chris M. Thomasson@3:633/10 to All on Wed May 27 19:51:04 2026
    On 5/27/2026 6:52 PM, Lynn McGuire wrote:
    [...]
    And I am creating a very large Win32 DLL with this code.

    Two or one? One to hold them all, one to rule them all... ;^D

    ÿ When I get it
    to working, I will then create a very large Win64 DLL with the code.ÿ I
    will have to ship both since several of my customers are using the
    current Win32 DLL.ÿ I have customers waiting for the Win64 DLL that will
    be callable from Excel x64.

    Lynn



    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lynn McGuire@3:633/10 to All on Thu May 28 00:17:58 2026
    On 5/27/2026 9:51 PM, Chris M. Thomasson wrote:
    On 5/27/2026 6:52 PM, Lynn McGuire wrote:
    [...]
    And I am creating a very large Win32 DLL with this code.

    Two or one? One to hold them all, one to rule them all... ;^D

    ÿ When I get it to working, I will then create a very large Win64 DLL
    with the code.ÿ I will have to ship both since several of my customers
    are using the current Win32 DLL.ÿ I have customers waiting for the
    Win64 DLL that will be callable from Excel x64.

    Lynn

    In the current Win32 version of our software, we ship ten Win32 EXEs
    that we make and three Win2 DLLs that we make. We also ship two Win32
    EXEs from others and eighteen Win32 DLLS from others. And we ship a
    myriad of data files and sample files. About a 380 MB install. 800,000
    lines of Fortran 77 code and 650,000 lines of C++ code. I am
    transitioning all of the Fortran code to C++ if things work out.

    Lynn


    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Keith Thompson@3:633/10 to All on Wed May 27 22:20:29 2026
    Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
    [...]
    The f2c.h file has:

    #ifdef INTEGER_STAR_8 /* Adjust for integer*8. */
    typedef int64_t longit;
    typedef uint64_t ulongint;
    [...]
    And there's an astonishing typo ("longit" rather than "longint"),
    which I can't find in any f2c source code, but it appears in versions 20200916-1 (Ubuntu 24.04.4) and 20240504-1build1 (Ubuntu 26.04).

    This bug originated in a Debian-specific patch in 2020, and
    propagated to Ubuntu (and presumably other Debian-based systems).

    I've reported it here:

    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1138079

    --
    Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
    void Void(void) { Void(); } /* The recursive call of the void */

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lynn McGuire@3:633/10 to All on Thu May 28 00:59:01 2026
    On 5/27/2026 9:46 PM, Chris M. Thomasson wrote:
    On 5/27/2026 6:40 PM, Lynn McGuire wrote:
    [...]
    Microsoft Visual C++ 2015, 32 bit win32, debug code, no pragmas, no
    special options.

    Fwiw, I used the live shit out of the compiler! Pretty good with C, C++ okay. Its fun that MSVC used to have better support for C than C++.

    The first C compiler I used was Turbo C in 1986 ?. The IDE was awesome
    for this guy who started programming with Fortran on punch cards in 1975
    in my Dads software company on a 4800 baud lease line to a Univac 1108.

    I went back to work with Dad in 1989, worked with the Unix boxen that we
    were shipping our software on. The cc compiler was fairly primitive and
    so was f77. For a while we were maintaining our software across ten
    platforms from Microsoft DOS, Vax VMS, VaxWindows, Prime, Apollo Domain,
    IBM RS/6000, Sun Workstation, HP UX, to two different types of IBM 3090 mainframes.

    The nice thing about Visual C++ 2015 is that the EXEs and DLLs work all
    the way back to Windows XP. We still have couple of customers on
    Windows XP at my last count, they may have upgraded by now.

    Lynn


    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From David Brown@3:633/10 to All on Thu May 28 08:18:58 2026
    On 28/05/2026 03:47, Lynn McGuire wrote:
    On 5/27/2026 6:52 PM, James Kuyper wrote:
    On 2026-05-27 18:08, Lynn McGuire wrote:
    On 5/21/2026 7:39 PM, Keith Thompson wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    How come I cannot do this in argument arrays in C++ ?

    int sicmct (const longint nprint, longint nprara [nprint])

    Because C++ does not support variable-length array types.

    So my C++ compiler likes

    ÿÿÿÿ int sicmct (const longint nprint, longint nprara [96])

    Of course - 96 is an integer constant expression, which is allowed in
    array declarations, and ignored if the array is declared as a function
    parameter - that declaration is treated as the equivalent of "longint
    *npara". Those rules are the same in both C and C++.
    Now,. some expressions count as integer constant expressions in C++ that
    only count as integer expressions in C. In general, an array declaration
    that had one of those expressions for the array length would make that
    array a variable length array in C. However, in a function parameter
    declaration the length simply gets ignored as a result of being
    converted to a pointer declaration.

    or

    ÿÿÿÿ int sicmct (const longint nprint, longint nprara [])

    Since the integer constant expression is unnecessary, it can be left out
    - that declaration is also equivalent to "longint *npara".

    I am really hoping that the debugger will use that [96] to know how much
    an array to show me in quickwatch.

    Otherwise it is a good hint for the next programmer that deals with this code.


    It is certainly a good thing from the "self-documenting code" viewpoint,
    but you need to make sure the value is accurate as the language can't
    help you check it.

    But if the size of the array is fixed, why not use std::array<longint,
    ? Then the size is part of the type and you can't make a mistake.


    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lynn McGuire@3:633/10 to All on Thu May 28 02:04:07 2026
    On 5/28/2026 1:18 AM, David Brown wrote:
    On 28/05/2026 03:47, Lynn McGuire wrote:
    On 5/27/2026 6:52 PM, James Kuyper wrote:
    On 2026-05-27 18:08, Lynn McGuire wrote:
    On 5/21/2026 7:39 PM, Keith Thompson wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    How come I cannot do this in argument arrays in C++ ?

    int sicmct (const longint nprint, longint nprara [nprint])

    Because C++ does not support variable-length array types.

    So my C++ compiler likes

    ÿÿÿÿ int sicmct (const longint nprint, longint nprara [96])

    Of course - 96 is an integer constant expression, which is allowed in
    array declarations, and ignored if the array is declared as a function
    parameter - that declaration is treated as the equivalent of "longint
    *npara". Those rules are the same in both C and C++.
    Now,. some expressions count as integer constant expressions in C++ that >>> only count as integer expressions in C. In general, an array declaration >>> that had one of those expressions for the array length would make that
    array a variable length array in C. However, in a function parameter
    declaration the length simply gets ignored as a result of being
    converted to a pointer declaration.

    or

    ÿÿÿÿ int sicmct (const longint nprint, longint nprara [])

    Since the integer constant expression is unnecessary, it can be left out >>> - that declaration is also equivalent to "longint *npara".

    I am really hoping that the debugger will use that [96] to know how
    much an array to show me in quickwatch.

    Otherwise it is a good hint for the next programmer that deals with
    this code.


    It is certainly a good thing from the "self-documenting code" viewpoint,
    but you need to make sure the value is accurate as the language can't
    help you check it.

    But if the size of the array is fixed, why not use std::array<longint,
    ?ÿ Then the size is part of the type and you can't make a mistake.

    Because I have a dynamic memory allocator in the old Fortran code and I
    do not want to deal with it today. There are thousands of memory
    allocations, reallocations, and frees in the old code. I may get rid of
    them someday but not today.

    Thanks,
    Lynn


    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Scott Lurndal@3:633/10 to All on Thu May 28 14:03:17 2026
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    On 5/27/2026 6:52 PM, James Kuyper wrote:
    On 2026-05-27 18:08, Lynn McGuire wrote:
    On 5/21/2026 7:39 PM, Keith Thompson wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    How come I cannot do this in argument arrays in C++ ?

    int sicmct (const longint nprint, longint nprara [nprint])

    Because C++ does not support variable-length array types.

    So my C++ compiler likes

    int sicmct (const longint nprint, longint nprara [96])

    Of course - 96 is an integer constant expression, which is allowed in
    array declarations, and ignored if the array is declared as a function
    parameter - that declaration is treated as the equivalent of "longint
    *npara". Those rules are the same in both C and C++.
    Now,. some expressions count as integer constant expressions in C++ that
    only count as integer expressions in C. In general, an array declaration
    that had one of those expressions for the array length would make that
    array a variable length array in C. However, in a function parameter
    declaration the length simply gets ignored as a result of being
    converted to a pointer declaration.

    or

    int sicmct (const longint nprint, longint nprara [])

    Since the integer constant expression is unnecessary, it can be left out
    - that declaration is also equivalent to "longint *npara".

    I am really hoping that the debugger will use that [96] to know how much
    an array to show me in quickwatch.

    Highly unlikely, as that value will not be preserved in the
    debugging information in the executable image.


    Otherwise it is a good hint for the next programmer that deals with this >code.

    I would think it is a bad hint and poor documentation. At the least,
    it should be a macro or a named constant, but the next programmer,
    who knows C/C++ would wonder why that was declared that way.


    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Mike Terry@3:633/10 to All on Thu May 28 18:05:08 2026
    On 28/05/2026 15:03, Scott Lurndal wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    On 5/27/2026 6:52 PM, James Kuyper wrote:
    On 2026-05-27 18:08, Lynn McGuire wrote:
    On 5/21/2026 7:39 PM, Keith Thompson wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    How come I cannot do this in argument arrays in C++ ?

    int sicmct (const longint nprint, longint nprara [nprint])

    Because C++ does not support variable-length array types.

    So my C++ compiler likes

    int sicmct (const longint nprint, longint nprara [96])

    Of course - 96 is an integer constant expression, which is allowed in
    array declarations, and ignored if the array is declared as a function
    parameter - that declaration is treated as the equivalent of "longint
    *npara". Those rules are the same in both C and C++.
    Now,. some expressions count as integer constant expressions in C++ that >>> only count as integer expressions in C. In general, an array declaration >>> that had one of those expressions for the array length would make that
    array a variable length array in C. However, in a function parameter
    declaration the length simply gets ignored as a result of being
    converted to a pointer declaration.

    or

    int sicmct (const longint nprint, longint nprara [])

    Since the integer constant expression is unnecessary, it can be left out >>> - that declaration is also equivalent to "longint *npara".

    I am really hoping that the debugger will use that [96] to know how much
    an array to show me in quickwatch.

    Highly unlikely, as that value will not be preserved in the
    debugging information in the executable image.

    Correct. It's possible to instruct the debugger (at debug time) to display an array of elements of
    a given size, for the Watch and QuickWatch windows. [Basically if buf is the pointer variable being
    watched, amend "buf" in the display window to "buf,20" to tell debugger to display array of 20
    elements. There's an online help page somewhere with the full syntax.] Or of course sort out your
    allocation issues and use std::array, which the debugger understands.

    [The debugger understands std::array, because somewhere there is a custom debugger "visualiser" for
    std::array. It might be possible to add a similar customisation for your array type. (Or it might
    not - I've never looked into that feature!)]

    Mike.



    Otherwise it is a good hint for the next programmer that deals with this
    code.

    I would think it is a bad hint and poor documentation. At the least,
    it should be a macro or a named constant, but the next programmer,
    who knows C/C++ would wonder why that was declared that way.


    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Mike Terry@3:633/10 to All on Thu May 28 18:12:09 2026
    On 28/05/2026 18:05, Mike Terry wrote:
    On 28/05/2026 15:03, Scott Lurndal wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    On 5/27/2026 6:52 PM, James Kuyper wrote:
    On 2026-05-27 18:08, Lynn McGuire wrote:
    On 5/21/2026 7:39 PM, Keith Thompson wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> writes:
    How come I cannot do this in argument arrays in C++ ?

    int sicmct (const longint nprint, longint nprara [nprint])

    Because C++ does not support variable-length array types.

    So my C++ compiler likes

    ????? int sicmct (const longint nprint, longint nprara [96])

    Of course - 96 is an integer constant expression, which is allowed in
    array declarations, and ignored if the array is declared as a function >>>> parameter - that declaration is treated as the equivalent of "longint
    *npara". Those rules are the same in both C and C++.
    Now,. some expressions count as integer constant expressions in C++ that >>>> only count as integer expressions in C. In general, an array declaration >>>> that had one of those expressions for the array length would make that >>>> array a variable length array in C. However, in a function parameter
    declaration the length simply gets ignored as a result of being
    converted to a pointer declaration.

    or

    ????? int sicmct (const longint nprint, longint nprara [])

    Since the integer constant expression is unnecessary, it can be left out >>>> - that declaration is also equivalent to "longint *npara".

    I am really hoping that the debugger will use that [96] to know how much >>> an array to show me in quickwatch.

    Highly unlikely, as that value will not be preserved in the
    debugging information in the executable image.

    Correct.? It's possible to instruct the debugger (at debug time) to display an array of elements of
    a given size, for the Watch and QuickWatch windows.? [Basically if buf is the pointer variable being
    watched, amend "buf" in the display window to "buf,20" to tell debugger to display array of 20
    elements.? There's an online help page somewhere with the full syntax.]? Or of course sort out your
    allocation issues and use std::array, which the debugger understands.

    [The debugger understands std::array, because somewhere there is a custom debugger "visualiser" for
    std::array.? It might be possible to add a similar customisation for your array type.? (Or it might
    not - I've never looked into that feature!)]


    Sorry, that's Visual Studio debugger specific. Not sure why I just assumed you were using VS!

    Mike.



    Otherwise it is a good hint for the next programmer that deals with this >>> code.

    I would think it is a bad hint and poor documentation.??? At the least,
    it should be a macro or a named constant, but the next programmer,
    who knows C/C++ would wonder why that was declared that way.


    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From red floyd@3:633/10 to All on Thu May 28 15:07:18 2026
    On 5/28/2026 10:12 AM, Mike Terry wrote:
    [redacted]

    Sorry, that's Visual Studio debugger specific.ÿ Not sure why I just
    assumed you were using VS!


    Lynn *is* using VS. Specifically VS2015.

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From boltar@3:633/10 to All on Fri May 29 08:44:50 2026
    On Thu, 28 May 2026 15:07:18 -0700
    red floyd <no.spam.here@its.invalid> gabbled:
    On 5/28/2026 10:12 AM, Mike Terry wrote:
    [redacted]

    Sorry, that's Visual Studio debugger specific.ÿ Not sure why I just
    assumed you were using VS!


    Lynn *is* using VS. Specifically VS2015.

    Off topic but given gdb crashed on me the other day for the 1st time ever it made me wonder - how to debugger writers debug their debugger? Presumably
    they can't use a debugger on their code because that'll set all the trace traps their new code will want to use.


    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Scott Lurndal@3:633/10 to All on Fri May 29 14:33:53 2026
    boltar@caprica.universe writes:
    On Thu, 28 May 2026 15:07:18 -0700
    red floyd <no.spam.here@its.invalid> gabbled:
    On 5/28/2026 10:12 AM, Mike Terry wrote:
    [redacted]

    Sorry, that's Visual Studio debugger specific.ÿ Not sure why I just
    assumed you were using VS!


    Lynn *is* using VS. Specifically VS2015.

    Off topic but given gdb crashed on me the other day for the 1st time ever it >made me wonder - how to debugger writers debug their debugger? Presumably >they can't use a debugger on their code because that'll set all the trace >traps their new code will want to use.

    Back in 1998, I wrote the in-kernel debugger (kdb) for linux.

    Debugging techniques in those days (on x86) involved a lot
    of logging, and where available, in-circuit emulators or
    simulators like AMD SimNow, although it was actually possible in most cases
    to use kdb to debug kdb, just as it is possible to debug
    gdb using gdb.

    $ gdb -q --args gdb -q --args ls /tmp/bb
    Reading symbols from gdb...Reading symbols from /home/scott/gdb...(no debugging symbols found)...done.
    (no debugging symbols found)...done.
    Missing separate debuginfos, use: debuginfo-install gdb-7.7.1-21.fc20.x86_64 (gdb) r
    Starting program: /usr/bin/gdb -q --args ls /tmp/bb

    (gdb) r
    Starting program: /usr/bin/ls /tmp/bb
    Detaching after fork from child process 29871.
    Detaching after fork from child process 29872.
    Detaching after fork from child process 29874.
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib64/libthread_db.so.1".
    a b
    [Inferior 1 (process 29871) exited normally]
    (gdb) q
    [Inferior 1 (process 29866) exited normally]
    (gdb) q
    $

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)