• Re: New VSI post on Youtube

    From =?UTF-8?Q?Arne_Vajh=C3=B8j?=@21:1/5 to All on Wed Aug 14 10:03:28 2024
    On 8/12/2024 10:53 PM, Arne Vajhøj wrote:
    Oracle and VMS Software on Application Development and Migration to x86:

    https://www.youtube.com/watch?v=BmLEI5O1JSw

    I have not seen & heard it all yet.

    Somewhere in the middle they summarize the status of the x86-64 port
    as: 8920 tests succeed + 271 tests fail + 608 test not run yet.

    Did this get lost in all the spam filters?

    I guess a YouTube link does look like spam, but ...

    Arne

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Simon Clubley@21:1/5 to arne@vajhoej.dk on Wed Aug 14 17:48:40 2024
    On 2024-08-14, Arne Vajh°j <arne@vajhoej.dk> wrote:
    On 8/12/2024 10:53 PM, Arne Vajh°j wrote:
    Oracle and VMS Software on Application Development and Migration to x86:

    https://www.youtube.com/watch?v=BmLEI5O1JSw

    I have not seen & heard it all yet.

    Somewhere in the middle they summarize the status of the x86-64 port
    as: 8920 tests succeed + 271 tests fail + 608 test not run yet.

    Did this get lost in all the spam filters?

    I guess a YouTube link does look like spam, but ...


    I did see this the first time around, but had nothing to say at the time.

    However, since you ask, I prefer a writeup rather than a 40 minute video
    for this kind of update, but based on the numbers above, they are making
    good progress but are not there yet.

    Based on the above, I would guess/hope early next year for them to be ready, which would put them a year behind schedule. It would be interesting to
    know the reasons for the failures however and what is different about the x86-64 environment that resulted in test differences that ended up being classified as failures.

    In total, there's about 10% of the tests which have not been done or have failed, but as we all know the first 90% of a project takes 90% of the
    time and the last 10% takes the other 90% of the time. :-)

    Simon.

    --
    Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
    Walking destinations on a map are further away than they appear.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Robert A. Brooks@21:1/5 to Simon Clubley on Wed Aug 14 14:07:02 2024
    On 8/14/2024 1:48 PM, Simon Clubley wrote:

    It would be interesting to
    know the reasons for the failures however and what is different about the x86-64 environment that resulted in test differences that ended up being classified as failures.

    I don't know specifically, but with my very limited experience with C++, the X86_64 compiler is much less accepting of the syntax that the Alpha and IA64 compilers
    accepted.

    Some of the changes are pretty mechanical (casting or simple refactoring); some are not.

    Don't ask me to describe the "some are not" part, because I'm getting help to deal wit
    those.

    For the tests failing, it may be due to code not yet working, but I don't have any inside knowledge there.


    --
    -- Rob

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Arne_Vajh=C3=B8j?=@21:1/5 to Simon Clubley on Wed Aug 14 14:07:31 2024
    On 8/14/2024 1:48 PM, Simon Clubley wrote:
    On 2024-08-14, Arne Vajhøj <arne@vajhoej.dk> wrote:
    On 8/12/2024 10:53 PM, Arne Vajhøj wrote:
    Oracle and VMS Software on Application Development and Migration to x86: >>>
    https://www.youtube.com/watch?v=BmLEI5O1JSw

    I have not seen & heard it all yet.

    Somewhere in the middle they summarize the status of the x86-64 port
    as: 8920 tests succeed + 271 tests fail + 608 test not run yet.

    Did this get lost in all the spam filters?

    I guess a YouTube link does look like spam, but ...


    I did see this the first time around, but had nothing to say at the time.

    However, since you ask, I prefer a writeup rather than a 40 minute video
    for this kind of update, but based on the numbers above, they are making
    good progress but are not there yet.

    I 100% agree.

    There is a link to the slide decks on Youtube.

    Based on the above, I would guess/hope early next year for them to be ready, which would put them a year behind schedule. It would be interesting to
    know the reasons for the failures however and what is different about the x86-64 environment that resulted in test differences that ended up being classified as failures.

    In total, there's about 10% of the tests which have not been done or have failed, but as we all know the first 90% of a project takes 90% of the
    time and the last 10% takes the other 90% of the time. :-)

    Slide 39 says H1CY2025 so "early next year".

    The slides list some of the challenges they had.

    In my poor wording:
    * like everybody else they had to start with cross compilers
    and then switch to native compilers
    * they need to generate native code, so they needed to get
    GEM2LLVM and LLVM backends from VSI and integrate them
    * like everybody else they got problems with C++ code because
    clang is not compatible with traditional VMS C++
    * they relied on some tools build with VAX SCAN and first
    VESTed and later AESTed - since no IEST exist they had to
    rewrite those tools (in Java)

    The slides does not say so, but it is probably a huge code base
    and given that some of it is 4 decades old, then there may be some
    hacks in the code.

    Oracle DB - what is known as Oracle Classic in the VMS world:
    https://news.ycombinator.com/item?id=18442941

    :-)

    Arne

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Robert A. Brooks@21:1/5 to All on Wed Aug 14 14:45:17 2024
    On 8/14/2024 2:33 PM, Arne Vajhøj wrote:
    On 8/14/2024 2:07 PM, Robert A. Brooks wrote:

    Some of the changes are pretty mechanical (casting or simple refactoring); some are not.

    Don't ask me to describe the "some are not" part, because I'm getting help to deal wit
    those.

    Being more strict is just one thing.

    I also believe it is missing some of the VMS specific extensions.

    And it has different size of long and pointers. Causing problems
    for two cases:
    * code that make implicit assumptions that those are 32 bit

    /POINTER_SIZE = 32 is your friend. In my case, all the pointers
    were 32 bits long, so that was an easy thing to add to the build.

    This is for the OMNI and OSAP products for industrial control.

    --
    -- Rob

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Arne_Vajh=C3=B8j?=@21:1/5 to Robert A. Brooks on Wed Aug 14 14:33:27 2024
    On 8/14/2024 2:07 PM, Robert A. Brooks wrote:
    On 8/14/2024 1:48 PM, Simon Clubley wrote:
    It would be interesting to
    know the reasons for the failures however and what is different about the
    x86-64 environment that resulted in test differences that ended up being
    classified as failures.

    I don't know specifically, but with my very limited experience with C++,
    the
    X86_64 compiler is much less accepting of the syntax that the Alpha and
    IA64 compilers
    accepted.

    Some of the changes are pretty mechanical (casting or simple
    refactoring); some are not.

    Don't ask me to describe the "some are not" part, because I'm getting
    help to deal wit
    those.

    Being more strict is just one thing.

    I also believe it is missing some of the VMS specific extensions.

    And it has different size of long and pointers. Causing problems
    for two cases:
    * code that make implicit assumptions that those are 32 bit
    * mixing C and C++

    Arne

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Arne_Vajh=C3=B8j?=@21:1/5 to Robert A. Brooks on Wed Aug 14 14:57:02 2024
    On 8/14/2024 2:45 PM, Robert A. Brooks wrote:
    On 8/14/2024 2:33 PM, Arne Vajhøj wrote:
    And it has different size of long and pointers. Causing problems
    for two cases:
    * code that make implicit assumptions that those are 32 bit

    /POINTER_SIZE = 32 is your friend.  In my case, all the pointers
    were 32 bits long, so that was an easy thing to add to the build.

    compile/POINTER_SIZE=32, LINK/SEG=CODE=P0 etc. can all help get stuff
    working.

    But it is not the right long term solution.

    Arne

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Arne_Vajh=C3=B8j?=@21:1/5 to All on Wed Aug 14 14:48:04 2024
    On 8/14/2024 2:33 PM, Arne Vajhøj wrote:
    And it has different size of long and pointers. Causing problems
    for two cases:
    * code that make implicit assumptions that those are 32 bit
    * mixing C and C++

    I am getting more and more convinced that C and C++
    code should completely switch to the explicit length
    model.

    So:

    #include <stdint.h>

    or:

    #include <cstdint>

    and use:

    int8_t
    int16_t
    int32_t
    int64_t
    uint8_t
    uint16_t
    uint32_t
    uint64_t

    and consider putting:

    #define int ">>>> DO NOT USE INT <<<<"
    #define short ">>>> DO NOT USE SHORT <<<<"
    #define long ">>>> DO NOT USE LONG <<<<"

    in as well to enforce.

    Where did I put that asbestos suit to protect me
    from the C/C++ crowd?

    :-)

    Arne

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Robert A. Brooks@21:1/5 to All on Wed Aug 14 15:49:28 2024
    On 8/14/2024 2:57 PM, Arne Vajhøj wrote:

    compile/POINTER_SIZE=32, LINK/SEG=CODE=P0 etc. can all help get stuff working.

    But it is not the right long term solution.

    For C++, the default pointer size should have remained 32.
    It was a mistake to change the default from what it was on Alpha and IA64.

    There is a lot of VMS-developed C++ code that expects a pointer size of 32,
    so in the case I cited, that compilation qualifer will remain forever, because the code will not change.

    --
    -- Rob

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Arne_Vajh=C3=B8j?=@21:1/5 to All on Wed Aug 14 16:23:47 2024
    On 8/14/2024 2:33 PM, Arne Vajhøj wrote:
    And it has different size of long and pointers. Causing problems
    for two cases:
    * code that make implicit assumptions that those are 32 bit
    * mixing C and C++

    And in case someone has not seen it:

    $ type long.h
    #ifdef __cplusplus
    extern "C" {
    #endif

    struct data
    {
    long a;
    long b;
    long c;
    long d;
    };

    #ifdef __cplusplus
    }
    #endif
    $ type long1.cxx
    #include "long.h"

    extern "C" {
    void f(struct data *d);
    }

    int main()
    {
    struct data o;
    o.a = 1;
    o.b = 2;
    o.c = 3;
    o.d = 4;
    f(&o);
    return 0;
    }
    $ type long2.c
    #include <stdio.h>

    #include "long.h"

    void f(struct data *o)
    {
    printf("%ld %ld %ld %ld\n", o->a, o->b, o->c, o->d);
    }
    $ cxx/name=upper long1
    $ cc long2
    $ link/exe=long long1 + long2
    $ run long
    1 0 2 0

    Arne

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Arne_Vajh=C3=B8j?=@21:1/5 to Robert A. Brooks on Wed Aug 14 16:21:39 2024
    On 8/14/2024 3:49 PM, Robert A. Brooks wrote:
    On 8/14/2024 2:57 PM, Arne Vajhøj wrote:
    compile/POINTER_SIZE=32, LINK/SEG=CODE=P0 etc. can all help get stuff
    working.

    But it is not the right long term solution.

    For C++, the default pointer size should have remained 32.
    It was a mistake to change the default from what it was on Alpha and IA64.

    Given how much C vs C++ issues we have seen, then I think there
    is a case for that.

    But as I understand it the plan was to keep C++ very close to out of
    the box clang.

    In hindsight ...

    There is a lot of VMS-developed C++ code that expects a pointer size of 32,

    I believe that.

    so in the case I cited, that compilation qualifer will remain forever, because
    the code will not change.

    Unless the system in question has EOL and replacement planned, then
    I doubt that.

    Everything eventually change or die.

    Arne

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Arne_Vajh=C3=B8j?=@21:1/5 to All on Wed Aug 14 19:18:11 2024
    On 8/14/2024 4:23 PM, Arne Vajhøj wrote:
    On 8/14/2024 2:33 PM, Arne Vajhøj wrote:
    And it has different size of long and pointers. Causing problems
    for two cases:
    * code that make implicit assumptions that those are 32 bit
    * mixing C and C++

    And in case someone has not seen it:

    $ type long.h

    And the same with pointers:

    $ type ptr.h
    #ifdef __cplusplus
    extern "C" {
    #endif

    struct data
    {
    void* a;
    void* b;
    void* c;
    void* d;
    };

    #ifdef __cplusplus
    }
    #endif
    $ type ptr1.cxx
    #include "ptr.h"

    extern "C" {
    void f(struct data *d);
    }

    int main()
    {
    struct data o;
    o.a = (void *)1;
    o.b = (void *)2;
    o.c = (void *)3;
    o.d = (void *)4;
    f(&o);
    return 0;
    }
    $ type ptr2.c
    #include <stdio.h>

    #include "ptr.h"

    void f(struct data *o)
    {
    printf("%p %p %p %p\n", o->a, o->b, o->c, o->d);
    }
    $ cxx/name=upper ptr1
    $ cc ptr2
    $ link/exe=ptr ptr1 + ptr2
    $ run ptr
    1 0 2 0
    $ cxx/name=upper/pointer=32 ptr1
    $ cc ptr2
    $ link/exe=ptr ptr1 + ptr2
    $ run ptr
    1 2 3 4
    $ cxx/name=upper ptr1
    $ cc/pointer=64 ptr2
    $ link/exe=ptr ptr1 + ptr2
    $ run ptr
    1 2 3 4

    Arne

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Arne_Vajh=C3=B8j?=@21:1/5 to Lawrence D'Oliveiro on Wed Aug 14 19:58:30 2024
    On 8/14/2024 7:47 PM, Lawrence D'Oliveiro wrote:
    On Wed, 14 Aug 2024 14:33:27 -0400, Arne Vajhøj wrote:
    And it has different size of long and pointers.

    If you wanted an integer type that is compatible with pointers, that was always intptr_t and uintptr_t, surely


    I am not being particular clear.

    I am not saying that:

    default sizeof long C++ x64 <> default sizeof pointer C++ x64

    I am saying that:

    default sizeof long C++ x64 <> default sizeof long C++ Itanium & Alpha
    default sizeof pointer C++ x64 <> default sizeof pointer C++ Itanium & Alpha

    and later:

    default sizeof long C++ x64 <> default sizeof long C x64
    default sizeof pointer C++ x64 <> default sizeof pointer C x64

    Arne

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to All on Thu Aug 15 00:07:41 2024
    On Wed, 14 Aug 2024 19:58:30 -0400, Arne Vajhøj wrote:

    I am saying that:

    default sizeof long C++ x64 <> default sizeof long C++ Itanium & Alpha default sizeof pointer C++ x64 <> default sizeof pointer C++ Itanium &
    Alpha

    and later:

    default sizeof long C++ x64 <> default sizeof long C x64

    This is why you have stdint.h.

    default sizeof pointer C++ x64 <> default sizeof pointer C x64

    Interesting ... is C++ always supposed to be ABI-compatible with C?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to All on Wed Aug 14 23:47:06 2024
    On Wed, 14 Aug 2024 14:33:27 -0400, Arne Vajhøj wrote:

    And it has different size of long and pointers.

    If you wanted an integer type that is compatible with pointers, that was
    always intptr_t and uintptr_t, surely

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Arne_Vajh=C3=B8j?=@21:1/5 to Lawrence D'Oliveiro on Wed Aug 14 20:24:04 2024
    On 8/14/2024 8:07 PM, Lawrence D'Oliveiro wrote:
    On Wed, 14 Aug 2024 19:58:30 -0400, Arne Vajhøj wrote:
    I am saying that:

    default sizeof long C++ x64 <> default sizeof long C++ Itanium & Alpha
    default sizeof pointer C++ x64 <> default sizeof pointer C++ Itanium &
    Alpha

    and later:

    default sizeof long C++ x64 <> default sizeof long C x64

    This is why you have stdint.h.

    Yes.

    But short/int/long/long long are unfortunately very common in C/C++
    code probably an order of magnitude larger than
    int8_t/int16_t/int32_t/int64_t.

    default sizeof pointer C++ x64 <> default sizeof pointer C x64

    Interesting ... is C++ always supposed to be ABI-compatible with C?

    I don't think there is any guarantee for such compatibility. Two
    different compilers are free to behave differently.

    But they were compatible on Alpha and Itanium.

    And I think C++ and C compilers of same origin are usually compatible
    on other platforms as well.

    It is practical. C++ code calling C code is quite common.

    Arne

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stephen Hoffman@21:1/5 to Robert A. Brooks on Wed Aug 14 20:35:07 2024
    On 2024-08-14 19:49:28 +0000, Robert A. Brooks said:

    On 8/14/2024 2:57 PM, Arne Vajh°j wrote:

    compile/POINTER_SIZE=32, LINK/SEG=CODE=P0 etc. can all help get stuff working.

    But it is not the right long term solution.
    For C++, the default pointer size should have remained 32.
    It was a mistake to change the default from what it was on Alpha and IA64.

    It was a mistake to use 32 and not 64 on Alpha and Itanium, but that
    pain will continue for the foreseeable future.


    --
    Pure Personal Opinion | HoffmanLabs LLC

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stephen Hoffman@21:1/5 to All on Wed Aug 14 20:34:01 2024
    On 2024-08-14 18:48:04 +0000, Arne Vajh°j said:

    On 8/14/2024 2:33 PM, Arne Vajh°j wrote:
    And it has different size of long and pointers. Causing problems
    for two cases:
    * code that make implicit assumptions that those are 32 bit
    * mixing C and C++

    I am getting more and more convinced that C and C++ code should
    completely switch to the explicit length model.
    ...
    Where did I put that asbestos suit to protect me from the C/C++ crowd?

    :-)

    Arne

    I'd have no issues with that.

    Don't forget [u]int_{fast,least}{n}_t available in C99 and later, too.

    That, and add deprecation warnings for the problem calls.

    One bunch has the deprecation warnings enabled by default, with _CRT_SECURE_NO_WARNINGS to disable those checks.

    Related (and eventually probably more accessible on OpenVMS x86-64) is clang-tidy: https://clang.llvm.org/extra/clang-tidy/checks/bugprone/unsafe-functions.html


    Semi-related to interoperating with C: https://ziglang.org/learn/why_zig_rust_d_cpp/

    Semi-related to Rdb: What is "large" to SQLite is quite possibly very
    much larger than OpenVMS and its apps.

    But given forty years of existing code in Rdb (and in OpenVMS),
    wholesale language migrations just aren't happening ever, and any
    incremental migrations, and refactoring and overhauls, are going to
    happen over decades at the fastest.



    --
    Pure Personal Opinion | HoffmanLabs LLC

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Craig A. Berry@21:1/5 to Stephen Hoffman on Wed Aug 14 20:26:00 2024
    On 8/14/24 7:35 PM, Stephen Hoffman wrote:
    On 2024-08-14 19:49:28 +0000, Robert A. Brooks said:

    On 8/14/2024 2:57 PM, Arne Vajhøj wrote:

    compile/POINTER_SIZE=32, LINK/SEG=CODE=P0 etc. can all help get stuff
    working.

    But it is not the right long term solution.
      For C++, the default pointer size should have remained 32.
    It was a mistake to change the default from what it was on Alpha and
    IA64.

    It was a mistake to use 32 and not 64 on Alpha and Itanium, but that
    pain will continue for the foreseeable future.

    It is past time to change the default. I suspect a lot of the
    difficulties in porting are not just from pointer sizes but also integer
    sizes. Specifying "long" because the docs for an API say to use a
    longword is a 40-year-old habit that will be hard to break, and not all
    of the APIs have 64-bit equivalents. A lot of things probably assume
    "long" is the same size as "int" even though that is now no longer the
    case. As far as I know there is no compiler switch to say
    /DATA_MODEL=ILP32 to override the new default of LP64.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From John Dallman@21:1/5 to Robert A. Brooks on Thu Aug 15 09:41:00 2024
    In article <v9iro6$fql6$1@dont-email.me>, FIRST.LAST@vmssoftware.com
    (Robert A. Brooks) wrote:

    I don't know specifically, but with my very limited experience with
    C++, the X86_64 compiler is much less accepting of the syntax that
    the Alpha and IA64 compilers accepted.

    C++ compilers have been getting pickier over the last couple of decades gradually. Programmers who have been using a succession of Microsoft or
    GCC versions over that time have made the changes incrementally, but
    doing them all at once would be a bit of a shock.

    John

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Simon Clubley@21:1/5 to arne@vajhoej.dk on Wed Aug 21 12:18:46 2024
    On 2024-08-20, Arne Vajh°j <arne@vajhoej.dk> wrote:
    On 8/20/2024 1:38 PM, Simon Clubley wrote:

    You forgot about InputStreamReader() to turn an InputStream into a Reader. :-)

    There are InputStreamReader to convert from InputStream to Reader and OutputStreamWriter to convert from OutputStream to Writer.

    And they are actually used, because some API's has classes that only has getInputStream()/getOutputStream() methods and not
    getReader()/getWriter() methods.

    All follow the model.

    After all, why miss the opportunity to have two parallel sets of APIs
    (byte versus character) instead of just the one API ? :-)

    Goodness knows why they didn't just add something like String's getBytes() >> method to the character APIs or add character support to the byte APIs...

    Because InputStream/OutputStream and Reader/Writer are fundamentally different.


    I may not have stated that clearly enough.

    The character model is built in top of a byte model, with character-specific knowledge in the character classes.

    The traditional Java way to add this additional functionality is to extend
    a class in a subclass and implement the additional functionality in the subclass.

    I am having a hard time seeing why they didn't just extend the byte I/O
    classes in this way to implement additional character functionality so
    that both character and byte I/O directly uses an InputStream (and likewise
    for an OutputStream). There should be no need for a character-specific
    Reader concept or an InputStreamReader() converter.

    Simon.

    --
    Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
    Walking destinations on a map are further away than they appear.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From chrisq@21:1/5 to Lawrence D'Oliveiro on Wed Aug 21 13:26:12 2024
    On 8/21/24 02:25, Lawrence D'Oliveiro wrote:
    On Tue, 20 Aug 2024 09:47:36 -0400, Arne Vajhøj wrote:

    Few languages support multiple return values.

    Even in C and Fortran, a function can return a struct.

    Better to declare the struct externally, then pass a pointer
    to it. Much tidier.

    Chris

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Arne_Vajh=C3=B8j?=@21:1/5 to Simon Clubley on Wed Aug 21 08:37:56 2024
    On 8/21/2024 8:18 AM, Simon Clubley wrote:
    On 2024-08-20, Arne Vajhøj <arne@vajhoej.dk> wrote:
    On 8/20/2024 1:38 PM, Simon Clubley wrote:
    After all, why miss the opportunity to have two parallel sets of APIs
    (byte versus character) instead of just the one API ? :-)

    Goodness knows why they didn't just add something like String's getBytes() >>> method to the character APIs or add character support to the byte APIs... >>
    Because InputStream/OutputStream and Reader/Writer are fundamentally
    different.


    I may not have stated that clearly enough.

    The character model is built in top of a byte model, with character-specific knowledge in the character classes.

    The traditional Java way to add this additional functionality is to extend
    a class in a subclass and implement the additional functionality in the subclass.

    Reader/Writer does not extend InputStream/OutputStream. They do not
    add functionality - they provide different functionality.

    They may use/encapsulate an InputStream/OutputStream, but that is implementation and invisible to the public API.

    I am having a hard time seeing why they didn't just extend the byte I/O classes in this way to implement additional character functionality so
    that both character and byte I/O directly uses an InputStream (and likewise for an OutputStream). There should be no need for a character-specific
    Reader concept or an InputStreamReader() converter.

    Mixing byte IO and character IO can be very dangerous (at least
    for encodings where characters can be multiple bytes).

    Having such a mixed API would create lots of problems for users
    actually mixing.

    Arne

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Arne_Vajh=C3=B8j?=@21:1/5 to chrisq on Wed Aug 21 14:13:24 2024
    On 8/21/2024 8:26 AM, chrisq wrote:
    On 8/21/24 02:25, Lawrence D'Oliveiro wrote:
    On Tue, 20 Aug 2024 09:47:36 -0400, Arne Vajhøj wrote:
    Few languages support multiple return values.

    Even in C and Fortran, a function can return a struct.

    Better to declare the struct externally, then pass a pointer
    to it. Much tidier.

    In C one should definitely return a pointer to struct and not
    a struct.

    It looks like VSI Fortran cannot return a structure as function
    result, but VSI Pascal can return a record as function result.

    And it is returned as a pointer argument under the hood.

    $ type s.pas
    module s;

    type
    iiituple = record
    a : integer;
    b : integer;
    c : integer;
    end;

    [global]
    function get : iiituple;

    var
    res : iiituple;

    begin
    res.a := 123;
    res.b := 456;
    res.c := 789;
    get := res;
    end;

    end.
    $ pas s
    $ type m.c
    #include <stdio.h>

    struct iiituple
    {
    int a;
    int b;
    int c;
    };

    void get(struct iiituple *res);

    int main()
    {
    struct iiituple res;
    get(&res);
    printf("%d %d %d\n", res.a, res.b, res.c);
    return 0;
    }
    $ cc m
    $ link m + s
    $ run m
    123 456 789

    Arne

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Arne_Vajh=C3=B8j?=@21:1/5 to All on Wed Aug 21 14:19:52 2024
    On 8/21/2024 2:13 PM, Arne Vajhøj wrote:
    On 8/21/2024 8:26 AM, chrisq wrote:
    On 8/21/24 02:25, Lawrence D'Oliveiro wrote:
    On Tue, 20 Aug 2024 09:47:36 -0400, Arne Vajhøj wrote:
    Few languages support multiple return values.

    Even in C and Fortran, a function can return a struct.

    Better to declare the struct externally, then pass a pointer
    to it. Much tidier.

    In C one should definitely return a pointer to struct and not
    a struct.

    It looks like VSI Fortran cannot return a structure as function
    result, but VSI Pascal can return a record as function result.

    And it is returned as a pointer argument under the hood.

    Unless it fits in a register, then it is returned
    as a true function result:

    $ type s2.pas
    module s2;

    type
    iituple = record
    a : integer;
    b : integer;
    end;

    [global]
    function get : iituple;

    var
    res : iituple;

    begin
    res.a := 123;
    res.b := 456;
    get := res;
    end;

    end.
    $ pas s2
    $ type m2.c
    #include <stdio.h>

    struct iituple
    {
    int a;
    int b;
    };

    struct iituple get();

    int main()
    {
    struct iituple res = get();
    printf("%d %d\n", res.a, res.b);
    return 0;
    }
    $ cc m2
    $ link m2 + s2
    $ run m2
    123 456

    Arne

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to chrisq on Wed Aug 21 23:47:26 2024
    On Wed, 21 Aug 2024 13:26:12 +0100, chrisq wrote:

    On 8/21/24 02:25, Lawrence D'Oliveiro wrote:

    On Tue, 20 Aug 2024 09:47:36 -0400, Arne Vajhøj wrote:

    Few languages support multiple return values.

    Even in C and Fortran, a function can return a struct.

    Better to declare the struct externally, then pass a pointer to it. Much tidier.

    But not so convenient for functional programming style.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Arne_Vajh=C3=B8j?=@21:1/5 to All on Wed Aug 21 20:12:13 2024
    On 8/21/2024 2:13 PM, Arne Vajhøj wrote:
    On 8/21/2024 8:26 AM, chrisq wrote:
    On 8/21/24 02:25, Lawrence D'Oliveiro wrote:
    On Tue, 20 Aug 2024 09:47:36 -0400, Arne Vajhøj wrote:
    Few languages support multiple return values.

    Even in C and Fortran, a function can return a struct.

    Better to declare the struct externally, then pass a pointer
    to it. Much tidier.

    In C one should definitely return a pointer to struct and not
    a struct.

    It looks like VSI Fortran cannot return a structure as function
    result, but VSI Pascal can return a record as function result.

    And it is returned as a pointer argument under the hood.

    $ type s.pas
    module s;

    type
       iiituple = record
                     a : integer;
                     b : integer;
                     c : integer;
                 end;

    [global]
    function get : iiituple;

    void get(struct iiituple *res);

    int main()
    {
        struct iiituple res;
        get(&res);

    Note that C follow the same convention, so:

    struct iiituple get();

    int main()
    {
    struct iiituple res = get();

    works just as well.

    Arne

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dave Froble@21:1/5 to Simon Clubley on Wed Aug 21 22:12:40 2024
    On 8/20/2024 8:36 AM, Simon Clubley wrote:
    On 2024-08-20, chrisq <devzero@nospam.com> wrote:

    I guess another complication is that some functions return
    -1, which implies a signed variable. To fix all that would require a
    complete rewrite of the library and probably most of the os and
    applications as well, so it will never happen. Just have to write
    unsigned equivalents, or slip functions with casts, but it's a lot
    of additional work.


    One thing I wish was available in all languages is the ability to return multiple values from a function call so you can return both a status and
    the value(s) in one assignment. Ie: "a, b, c = demo_function(param1, param2);".

    In languages with dynamic associative arrays (such as PHP), I simulate
    this by returning an associative array from a function call with both
    status and value fields. Makes coding _so_ much cleaner and robust.

    Simon.


    Is there any real difference between your practice, and including a completion status parameter in the function call?

    --
    David Froble Tel: 724-529-0450
    Dave Froble Enterprises, Inc. E-Mail: davef@tsoft-inc.com
    DFE Ultralights, Inc.
    170 Grimplin Road
    Vanderbilt, PA 15486

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dave Froble@21:1/5 to All on Wed Aug 21 22:16:33 2024
    On 8/20/2024 9:35 PM, Arne Vajhøj wrote:
    On 8/20/2024 9:25 PM, Lawrence D'Oliveiro wrote:
    On Tue, 20 Aug 2024 09:47:36 -0400, Arne Vajhøj wrote:
    Few languages support multiple return values.

    Even in C and Fortran, a function can return a struct.

    Yes. But that is returning a single value - just a composite value.

    It works fine, but it requires a custom type.

    Arne


    Hmmm ... what is wrong with a "custom type", or what I'd call a structure?

    --
    David Froble Tel: 724-529-0450
    Dave Froble Enterprises, Inc. E-Mail: davef@tsoft-inc.com
    DFE Ultralights, Inc.
    170 Grimplin Road
    Vanderbilt, PA 15486

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dave Froble@21:1/5 to Lawrence D'Oliveiro on Wed Aug 21 22:17:41 2024
    On 8/20/2024 9:51 PM, Lawrence D'Oliveiro wrote:
    On Tue, 20 Aug 2024 21:35:44 -0400, Arne Vajhøj wrote:

    On 8/20/2024 9:25 PM, Lawrence D'Oliveiro wrote:

    On Tue, 20 Aug 2024 09:47:36 -0400, Arne Vajhøj wrote:

    Few languages support multiple return values.

    Even in C and Fortran, a function can return a struct.

    Yes. But that is returning a single value - just a composite value.

    The distinction between “multiple value” versus “single composite value”
    is an artificial one specific to languages like Lisp. Python, for example,
    is quite happy with constructs like

    a, b = struct.unpack("hh", b"\x00\x00\xff\xff")

    That's kind of ugly, isn't it?


    --
    David Froble Tel: 724-529-0450
    Dave Froble Enterprises, Inc. E-Mail: davef@tsoft-inc.com
    DFE Ultralights, Inc.
    170 Grimplin Road
    Vanderbilt, PA 15486

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dave Froble@21:1/5 to bill on Wed Aug 21 22:20:57 2024
    On 8/20/2024 1:34 PM, bill wrote:
    On 8/20/2024 8:36 AM, Simon Clubley wrote:
    On 2024-08-20, chrisq <devzero@nospam.com> wrote:

    I guess another complication is that some functions return
    -1, which implies a signed variable. To fix all that would require a
    complete rewrite of the library and probably most of the os and
    applications as well, so it will never happen. Just have to write
    unsigned equivalents, or slip functions with casts, but it's a lot
    of additional work.


    One thing I wish was available in all languages is the ability to return
    multiple values from a function call so you can return both a status and
    the value(s) in one assignment. Ie: "a, b, c = demo_function(param1, param2);".

    In languages with dynamic associative arrays (such as PHP), I simulate
    this by returning an associative array from a function call with both
    status and value fields. Makes coding _so_ much cleaner and robust.


    And probably much harder to understand in anything but the most
    trivial usage.

    bill



    Would that not be rather clear with adequate comments about what is being done?

    --
    David Froble Tel: 724-529-0450
    Dave Froble Enterprises, Inc. E-Mail: davef@tsoft-inc.com
    DFE Ultralights, Inc.
    170 Grimplin Road
    Vanderbilt, PA 15486

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Arne_Vajh=C3=B8j?=@21:1/5 to Dave Froble on Wed Aug 21 22:21:24 2024
    On 8/21/2024 10:16 PM, Dave Froble wrote:
    On 8/20/2024 9:35 PM, Arne Vajhøj wrote:
    On 8/20/2024 9:25 PM, Lawrence D'Oliveiro wrote:
    On Tue, 20 Aug 2024 09:47:36 -0400, Arne Vajhøj wrote:
    Few languages support multiple return values.

    Even in C and Fortran, a function can return a struct.

    Yes. But that is returning a single value - just a composite value.

    It works fine, but it requires a custom type.

    Hmmm ...  what is wrong with a "custom type", or what I'd call a structure?

    It adds code. Unnecessary code.

    It is a types added not because they exist in the business domain, but
    because there is a need to return a bundle of values.

    And the number of possible bundle types is huge.

    Multiple return values, generic tuple classes, real tuple etc. avoid
    all that.

    Arne

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dave Froble@21:1/5 to Simon Clubley on Wed Aug 21 22:22:10 2024
    On 8/20/2024 1:47 PM, Simon Clubley wrote:
    On 2024-08-20, bill <bill.gunshannon@gmail.com> wrote:
    On 8/20/2024 8:36 AM, Simon Clubley wrote:
    On 2024-08-20, chrisq <devzero@nospam.com> wrote:

    I guess another complication is that some functions return
    -1, which implies a signed variable. To fix all that would require a
    complete rewrite of the library and probably most of the os and
    applications as well, so it will never happen. Just have to write
    unsigned equivalents, or slip functions with casts, but it's a lot
    of additional work.


    One thing I wish was available in all languages is the ability to return >>> multiple values from a function call so you can return both a status and >>> the value(s) in one assignment. Ie: "a, b, c = demo_function(param1, param2);".

    In languages with dynamic associative arrays (such as PHP), I simulate
    this by returning an associative array from a function call with both
    status and value fields. Makes coding _so_ much cleaner and robust.


    And probably much harder to understand in anything but the most
    trivial usage.


    Huh ? Well that shows you haven't done this kind of thing. :-)

    If you are talking about PHP, you construct an associative array
    in the return statement of the function and then access the keys
    in the caller. Very clean.

    If you are talking about some future thing based on C, you simply
    extend the function prototype to include a list of return types
    instead of the single type it is at the moment and you just return
    the list in the function's return statement.

    $ set response/mode=good_natured

    Or are associative arrays and other higher-level data structures an alien concept to you ? :-)

    Uh ... sometimes ...

    :-)


    --
    David Froble Tel: 724-529-0450
    Dave Froble Enterprises, Inc. E-Mail: davef@tsoft-inc.com
    DFE Ultralights, Inc.
    170 Grimplin Road
    Vanderbilt, PA 15486

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Arne_Vajh=C3=B8j?=@21:1/5 to Dave Froble on Wed Aug 21 22:24:18 2024
    On 8/21/2024 10:22 PM, Dave Froble wrote:
    On 8/20/2024 1:47 PM, Simon Clubley wrote:
    $ set response/mode=good_natured

    Or are associative arrays and other higher-level data structures an alien
    concept to you ? :-)

    Uh ... sometimes ...

    :-)

    You did do a little VB6/VB.NET many years ago?

    PHP associative arrays = VB6/VB.NET dictionaries

    Arne

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From John Dallman@21:1/5 to D'Oliveiro on Wed Aug 28 16:35:00 2024
    In article <valhi8$34s18$4@dont-email.me>, ldo@nz.invalid (Lawrence
    D'Oliveiro) wrote:

    Perl actually has a vast range of builtins.

    True, but they are at least all in one list. The problem I've had with
    Python is finding what the word is to do a thing.

    Python is actually a fairly small language. Its core language spec
    is less than 20% the size of the core Java language spec.

    This does not really help your case: Java is another example of an
    overblown language.

    The Python spec only lists 35 keywords <https://docs.python.org/3/reference/lexical_analysis.html#keywords>
    . Is that a lot to you?

    No, but that's well short of the things I need to learn to write
    practical Python code. The file handling library functions are a prime
    example. The list rapidly grows larger than the Perl builtins, and is
    less well organised.

    Yes, Perl also has a large library that is not as well organised as the builtins. You aren't forced to use it, and I mostly don't.

    You never had functions and classes as first-class objects in BASIC
    or COBOL; you do in Python. You never had metaclasses in those
    languages; you do in Python. You never had custom operator
    overloads in those languages; you do in Python.

    You've missed my point. BASIC and COBOL are languages where you have to
    learn specific words to do specific things; Python has that in common
    with them. Many of those words are library functions rather than builtins,
    but that makes little practical difference in learning the language.

    I find learning the things I need to use to write practical development utilities in Python much harder than I did when learning Perl. I am older
    than I was when learning Perl, but more experienced in learning new
    languages. Writing this, I've realised that part of the reason for this
    is that the kind of code I need to write in one or the other of these
    languages is exactly the kind of thing Perl is meant for: gluing other
    programs together. Python has much larger ambitions and isn't as focused
    on my use case.

    Several younger people at work came to us as determined advocates of
    Python. They're written some useful tools in it, but the core of the development environment remains Perl. One of them who regarded Perl as
    very difficult found he got to grips with it naturally once he had some
    motive: using a parser written in Perl to output JSON for his pet project.


    John

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to John Dallman on Thu Aug 29 01:49:17 2024
    On Wed, 28 Aug 2024 16:35 +0100 (BST), John Dallman wrote:

    In article <valhi8$34s18$4@dont-email.me>, ldo@nz.invalid (Lawrence D'Oliveiro) wrote:

    Perl actually has a vast range of builtins.

    True, but they are at least all in one list. The problem I've had with
    Python is finding what the word is to do a thing.

    I’m not sure I understand that. Python does things by “constructs” rather than individual “words”. Do you mean function and class names?

    Python is actually a fairly small language. Its core language spec is
    less than 20% the size of the core Java language spec.

    This does not really help your case: Java is another example of an
    overblown language.

    Why, do you think Java is some kind of outlier?

    The file handling library functions are a prime
    example. The list rapidly grows larger than the Perl builtins, and is
    less well organised.

    There is really just the “open” builtin function, and the “io” module for
    the basic class definitions, and things like text/binary conversions and in-memory I/O. And “os” for lower-level OS-specific stuff, and “os.path”
    for pathname handling. Temporary files are handled by tempfile, globbing
    done by glob and fnmatch, and there’s shutil to provide higher-level operations like the equivalent of “rm -r”. That’s about it, really. Did I miss anything?

    Note that string formatting/parsing is not part of I/O.

    You never had functions and classes as first-class objects in BASIC or
    COBOL; you do in Python. You never had metaclasses in those languages;
    you do in Python. You never had custom operator overloads in those
    languages; you do in Python.

    You've missed my point. BASIC and COBOL are languages where you have to
    learn specific words to do specific things; Python has that in common
    with them.

    But you just said above that you can’t seem to find those “words” (whatever they are) in Python: so clearly by your own admission it doesn’t work that way at all.

    Several younger people at work came to us as determined advocates of
    Python. They're written some useful tools in it, but the core of the development environment remains Perl.

    There is a wonderful environment called “Jupyter”, which uses the notebook paradigm with “cells” that can contain program code or explanatory text. Program cells can generate various forms of rich output, like graphics,
    audio, video, even interactive widgets.

    It was originally for Python (the original project was called “IPython”), but now supports a range of other languages.

    I like to use it for “scratchpad” programming: write a few lines to try something out, then either copy and paste working bits into something more substantial, or just chuck it away.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Simon Clubley@21:1/5 to arne@vajhoej.dk on Thu Aug 15 12:34:22 2024
    On 2024-08-14, Arne Vajh°j <arne@vajhoej.dk> wrote:
    On 8/14/2024 2:33 PM, Arne Vajh°j wrote:
    And it has different size of long and pointers. Causing problems
    for two cases:
    * code that make implicit assumptions that those are 32 bit
    * mixing C and C++

    I am getting more and more convinced that C and C++
    code should completely switch to the explicit length
    model.

    So:

    #include <stdint.h>

    or:

    #include <cstdint>

    and use:

    int8_t
    int16_t
    int32_t
    int64_t
    uint8_t
    uint16_t
    uint32_t
    uint64_t

    and consider putting:

    #define int ">>>> DO NOT USE INT <<<<"
    #define short ">>>> DO NOT USE SHORT <<<<"
    #define long ">>>> DO NOT USE LONG <<<<"

    in as well to enforce.

    Where did I put that asbestos suit to protect me
    from the C/C++ crowd?


    That works great until you need to interface to the OS unfortunately.

    BTW, I've been writing my own code with explicit sizing for many years.

    To extend this, I also know the difference between signed and unsigned variables and I have a default-unsigned approach unless I absolutely
    _need_ a signed variable.

    Unfortunately, a lot of the material out there doesn't seem to understand
    that designing a program is about modelling a real-world problem and that
    it isn't OK to just use a signed integer to store an unsigned value.

    Simon.

    --
    Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
    Walking destinations on a map are further away than they appear.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Arne_Vajh=C3=B8j?=@21:1/5 to John Dallman on Thu Aug 15 08:24:39 2024
    On 8/15/2024 4:41 AM, John Dallman wrote:
    In article <v9iro6$fql6$1@dont-email.me>, FIRST.LAST@vmssoftware.com
    (Robert A. Brooks) wrote:
    I don't know specifically, but with my very limited experience with
    C++, the X86_64 compiler is much less accepting of the syntax that
    the Alpha and IA64 compilers accepted.

    C++ compilers have been getting pickier over the last couple of decades gradually. Programmers who have been using a succession of Microsoft or
    GCC versions over that time have made the changes incrementally, but
    doing them all at once would be a bit of a shock.

    Why do I think of:

    VAX C 3.x -> DEC C 4.x -> DEC C 5.x

    back in the 90's?

    :-)

    Arne

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Simon Clubley@21:1/5 to arne@vajhoej.dk on Thu Aug 15 12:38:28 2024
    On 2024-08-15, Arne Vajh°j <arne@vajhoej.dk> wrote:
    On 8/15/2024 4:41 AM, John Dallman wrote:
    In article <v9iro6$fql6$1@dont-email.me>, FIRST.LAST@vmssoftware.com
    (Robert A. Brooks) wrote:
    I don't know specifically, but with my very limited experience with
    C++, the X86_64 compiler is much less accepting of the syntax that
    the Alpha and IA64 compilers accepted.

    C++ compilers have been getting pickier over the last couple of decades
    gradually. Programmers who have been using a succession of Microsoft or
    GCC versions over that time have made the changes incrementally, but
    doing them all at once would be a bit of a shock.

    Why do I think of:

    VAX C 3.x -> DEC C 4.x -> DEC C 5.x

    back in the 90's?

    :-)


    Why do I think of John having to support /STANDARD=VAXC in 2024 ? :-)

    Simon.

    --
    Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
    Walking destinations on a map are further away than they appear.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Arne_Vajh=C3=B8j?=@21:1/5 to Simon Clubley on Thu Aug 15 10:00:26 2024
    On 8/15/2024 8:34 AM, Simon Clubley wrote:
    On 2024-08-14, Arne Vajhøj <arne@vajhoej.dk> wrote:
    On 8/14/2024 2:33 PM, Arne Vajhøj wrote:
    And it has different size of long and pointers. Causing problems
    for two cases:
    * code that make implicit assumptions that those are 32 bit
    * mixing C and C++

    I am getting more and more convinced that C and C++
    code should completely switch to the explicit length
    model.

    That works great until you need to interface to the OS unfortunately.

    Encapsulate and handle the conversion between stdint API and
    various CRTL/OS API's.

    Do test builds on all sorts of platforms with high warning level to
    see if someone went unnoticed.

    Arne

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Arne_Vajh=C3=B8j?=@21:1/5 to Simon Clubley on Thu Aug 15 09:59:41 2024
    On 8/15/2024 8:34 AM, Simon Clubley wrote:
    On 2024-08-14, Arne Vajhøj <arne@vajhoej.dk> wrote:
    On 8/14/2024 2:33 PM, Arne Vajhøj wrote:
    And it has different size of long and pointers. Causing problems
    for two cases:
    * code that make implicit assumptions that those are 32 bit
    * mixing C and C++

    I am getting more and more convinced that C and C++
    code should completely switch to the explicit length
    model.

    That works great until you need to interface to the OS unfortunately.

    Encapsulate and handle the conversion between stdint API and
    various CRTL/OS API's.

    Do test builds on all sorts of platforms with high warning level to
    see if someone went unnoticed.

    Arne

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to All on Thu Aug 15 23:57:42 2024
    On Wed, 14 Aug 2024 14:07:31 -0400, Arne Vajhøj wrote:

    However, since you ask, I prefer a writeup rather than a 40 minute
    video for this kind of update ...

    I 100% agree.

    Have you tried playing the video at a higher speed, to get through it
    quicker?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Simon Clubley@21:1/5 to Dave Froble on Thu Aug 22 17:39:32 2024
    On 2024-08-21, Dave Froble <davef@tsoft-inc.com> wrote:
    On 8/20/2024 1:34 PM, bill wrote:
    On 8/20/2024 8:36 AM, Simon Clubley wrote:
    On 2024-08-20, chrisq <devzero@nospam.com> wrote:

    I guess another complication is that some functions return
    -1, which implies a signed variable. To fix all that would require a
    complete rewrite of the library and probably most of the os and
    applications as well, so it will never happen. Just have to write
    unsigned equivalents, or slip functions with casts, but it's a lot
    of additional work.


    One thing I wish was available in all languages is the ability to return >>> multiple values from a function call so you can return both a status and >>> the value(s) in one assignment. Ie: "a, b, c = demo_function(param1, param2);".

    In languages with dynamic associative arrays (such as PHP), I simulate
    this by returning an associative array from a function call with both
    status and value fields. Makes coding _so_ much cleaner and robust.


    And probably much harder to understand in anything but the most
    trivial usage.


    Would that not be rather clear with adequate comments about what is being done?


    Look at the example Arne posted. Very clean and very easy to understand
    without having to use comments (and I am actually a fan of the liberal
    use of comments. :-) ).

    Simon.

    --
    Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
    Walking destinations on a map are further away than they appear.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Simon Clubley@21:1/5 to Dave Froble on Thu Aug 22 17:36:39 2024
    On 2024-08-21, Dave Froble <davef@tsoft-inc.com> wrote:
    On 8/20/2024 8:36 AM, Simon Clubley wrote:

    One thing I wish was available in all languages is the ability to return
    multiple values from a function call so you can return both a status and
    the value(s) in one assignment. Ie: "a, b, c = demo_function(param1, param2);".

    In languages with dynamic associative arrays (such as PHP), I simulate
    this by returning an associative array from a function call with both
    status and value fields. Makes coding _so_ much cleaner and robust.


    Is there any real difference between your practice, and including a completion
    status parameter in the function call?


    Yes. It's conceptually not a parameter. It's a result status that determines
    if the result returned is valid. Returning multiple values is also a lot cleaner and much more generic than having to add a parameter for each out
    value to be returned.

    Simon.

    --
    Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
    Walking destinations on a map are further away than they appear.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Arne_Vajh=C3=B8j?=@21:1/5 to Simon Clubley on Thu Aug 22 16:25:21 2024
    On 8/22/2024 1:39 PM, Simon Clubley wrote:
    On 2024-08-21, Dave Froble <davef@tsoft-inc.com> wrote:
    On 8/20/2024 1:34 PM, bill wrote:
    On 8/20/2024 8:36 AM, Simon Clubley wrote:
    In languages with dynamic associative arrays (such as PHP), I simulate >>>> this by returning an associative array from a function call with both
    status and value fields. Makes coding _so_ much cleaner and robust.

    And probably much harder to understand in anything but the most
    trivial usage.

    Would that not be rather clear with adequate comments about what is being done?

    Look at the example Arne posted. Very clean and very easy to understand without having to use comments (and I am actually a fan of the liberal
    use of comments. :-) ).

    The same example in older VB.NET:

    Imports System
    Imports System.Collections.Generic

    Namespace MR
    Public Class Program
    Public Shared Function FourOps(a As Double, b As Double) As IDictionary(Of String, Double)
    Dim res As New Dictionary(Of String, Double)()
    res("plus") = a + b
    res("minus") = a - b
    res("multiply") = a * b
    res("divide") = a / b
    Return res
    End Function
    Public Shared Sub Main(args As String())
    Dim a As Double = 3.0
    Dim b As Double = 2.0
    Dim res As IDictionary(Of String, Double) = FourOps(a, b)
    Console.WriteLine("{0} + {1} = {2}", a, b, res("plus"))
    Console.WriteLine("{0} - {1} = {2}", a, b, res("minus"))
    Console.WriteLine("{0} * {1} = {2}", a, b, res("multiply"))
    Console.WriteLine("{0} / {1} = {2}", a, b, res("divide"))
    Console.ReadKey()
    End Sub
    End Class
    End Namespace

    In newer VB.NET it looks like:

    Imports System
    Imports System.Collections.Generic

    Namespace MR
    Public Class Program
    Public Shared Function FourOps(a As Double, b As Double) As IDictionary(Of String, Double)
    Return New Dictionary(Of String, Double)() From { _
    {"plus", a + b}, _
    {"minus", a - b}, _
    {"multiply", a * b}, _
    {"divide", a / b} _
    }
    End Function
    Public Shared Sub Main(args As String())
    Dim a As Double = 3.0
    Dim b As Double = 2.0
    Dim res As IDictionary(Of String, Double) = FourOps(a, b)
    Console.WriteLine("{0} + {1} = {2}", a, b, res("plus"))
    Console.WriteLine("{0} - {1} = {2}", a, b, res("minus"))
    Console.WriteLine("{0} * {1} = {2}", a, b, res("multiply"))
    Console.WriteLine("{0} / {1} = {2}", a, b, res("divide"))
    Console.ReadKey()
    End Sub
    End Class
    End Namespace

    But I suspect that David as a Basic connoisseur consider that dictionary initializer syntax copied directly from C# an abomination - curly
    brackets is not real Basic.

    Arne

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From chrisq@21:1/5 to All on Fri Aug 23 00:12:18 2024
    On 8/21/24 19:13, Arne Vajhøj wrote:
    On 8/21/2024 8:26 AM, chrisq wrote:
    On 8/21/24 02:25, Lawrence D'Oliveiro wrote:
    On Tue, 20 Aug 2024 09:47:36 -0400, Arne Vajhøj wrote:
    Few languages support multiple return values.

    Even in C and Fortran, a function can return a struct.

    Better to declare the struct externally, then pass a pointer
    to it. Much tidier.

    In C one should definitely return a pointer to struct and not

    Problem is that of you return a pointer, that suggests that the
    struct has been declared static inside the called function. That
    would be a fail for reentant code that might be called from
    elsewhere, say, from an interrupt handler, or another thread.
    The struct would typically be on the stack or heap, and would
    disappear on return from the call, making the return value
    invalid. Ideally, in a multitasking os, all code should be
    designed to be fully reentrant, to make it safe in all
    situations.

    Chris

    a struct.

    It looks like VSI Fortran cannot return a structure as function
    result, but VSI Pascal can return a record as function result.

    And it is returned as a pointer argument under the hood.

    $ type s.pas
    module s;

    type
       iiituple = record
                     a : integer;
                     b : integer;
                     c : integer;
                 end;

    [global]
    function get : iiituple;

    var
       res : iiituple;

    begin
       res.a := 123;
       res.b := 456;
       res.c := 789;
       get := res;
    end;

    end.
    $ pas s
    $ type m.c
    #include <stdio.h>

    struct iiituple
    {
        int a;
        int b;
        int c;
    };

    void get(struct iiituple *res);

    int main()
    {
        struct iiituple res;
        get(&res);
        printf("%d %d %d\n", res.a, res.b, res.c);
        return 0;
    }
    $ cc m
    $ link m + s
    $ run m
    123 456 789

    Arne


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Arne_Vajh=C3=B8j?=@21:1/5 to chrisq on Thu Aug 22 19:21:07 2024
    On 8/22/2024 7:12 PM, chrisq wrote:
    On 8/21/24 19:13, Arne Vajhøj wrote:
    On 8/21/2024 8:26 AM, chrisq wrote:
    On 8/21/24 02:25, Lawrence D'Oliveiro wrote:
    On Tue, 20 Aug 2024 09:47:36 -0400, Arne Vajhøj wrote:
    Few languages support multiple return values.

    Even in C and Fortran, a function can return a struct.

    Better to declare the struct externally, then pass a pointer
    to it. Much tidier.

    In C one should definitely return a pointer to struct and not

    Problem is that of you return a pointer, that suggests that the
    struct has been declared static inside the called function. That
    would be a fail for reentant code that might be called from
    elsewhere, say, from an interrupt handler, or another thread.
    The struct would  typically be on the stack or heap, and would
    disappear on return from the call, making the return value
    invalid. Ideally, in a multitasking os, all code should be
    designed to be fully reentrant, to make it safe in all
    situations.

    My assumption would be that the struct was malloc'ed in
    the function.

    That obvious also has its problem. One can write in
    72 point bold red blinking font that it is the callers
    responsibility to call free and it will still be
    forgotten in some cases.

    Arne

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to chrisq on Fri Aug 23 00:45:06 2024
    On Fri, 23 Aug 2024 00:12:18 +0100, chrisq wrote:

    Problem is that of you return a pointer, that suggests that the struct
    has been declared static inside the called function. That would be a
    fail for reentant code that might be called from elsewhere, say, from an interrupt handler, or another thread. The struct would typically be on
    the stack or heap, and would disappear on return from the call, making
    the return value invalid. Ideally, in a multitasking os, all code should
    be designed to be fully reentrant, to make it safe in all situations.

    One notorious POSIX-related example is the crypt(3) function <https://manpages.debian.org/3/crypt.3.en.html>.

    I was helping a client reinstall some old proprietary app that had
    been running on an ancient machine that had crashed. For the new
    setup, we thought we’d try a slightly less ancient version of Debian
    (I think the original machine had been running Debian 4). But logins
    wouldn’t work. Even worse, the errors didn’t make sense: instead of
    saying that the username or password was invalid, it was reporting
    something crazy like errors to do with SELinux or something (we
    weren’t using SELinux).

    Finally, I made a wild, desperate guess: the code was copying the
    result from the crypt call into a fixed-size buffer, which wasn’t big
    enough to hold the hash for newer password algorithms. This was
    leading to a buffer overflow when hashing perfectly valid passwords,
    which in turn was corrupting some data elsewhere and triggering the
    spurious errors.

    So I had to try and find an older algorithm that the system still
    supported, which would bring the hash size within range, and use that
    hash for the relevant passwords.

    And that worked.

    You’ll see from the above man page that POSIX has no official solution
    to this problem: there are calls available in Linux (courtesy of the
    Openwall project) that will use dynamically-allocated buffers; but of
    course they will likely not be available on other systems that claim
    to be POSIX-compatible.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dave Froble@21:1/5 to Simon Clubley on Thu Aug 22 23:06:35 2024
    On 8/22/2024 1:39 PM, Simon Clubley wrote:
    On 2024-08-21, Dave Froble <davef@tsoft-inc.com> wrote:
    On 8/20/2024 1:34 PM, bill wrote:
    On 8/20/2024 8:36 AM, Simon Clubley wrote:
    On 2024-08-20, chrisq <devzero@nospam.com> wrote:

    I guess another complication is that some functions return
    -1, which implies a signed variable. To fix all that would require a >>>>> complete rewrite of the library and probably most of the os and
    applications as well, so it will never happen. Just have to write
    unsigned equivalents, or slip functions with casts, but it's a lot
    of additional work.


    One thing I wish was available in all languages is the ability to return >>>> multiple values from a function call so you can return both a status and >>>> the value(s) in one assignment. Ie: "a, b, c = demo_function(param1, param2);".

    In languages with dynamic associative arrays (such as PHP), I simulate >>>> this by returning an associative array from a function call with both
    status and value fields. Makes coding _so_ much cleaner and robust.


    And probably much harder to understand in anything but the most
    trivial usage.


    Would that not be rather clear with adequate comments about what is being done?


    Look at the example Arne posted. Very clean and very easy to understand without having to use comments (and I am actually a fan of the liberal
    use of comments. :-) ).

    Simon.


    I find it rather difficult to determine WHY something is being done, just from the code.

    --
    David Froble Tel: 724-529-0450
    Dave Froble Enterprises, Inc. E-Mail: davef@tsoft-inc.com
    DFE Ultralights, Inc.
    170 Grimplin Road
    Vanderbilt, PA 15486

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael S@21:1/5 to arne@vajhoej.dk on Fri Aug 23 11:14:04 2024
    On Thu, 22 Aug 2024 19:21:07 -0400
    Arne Vajh°j <arne@vajhoej.dk> wrote:

    On 8/22/2024 7:12 PM, chrisq wrote:
    On 8/21/24 19:13, Arne Vajh°j wrote:
    On 8/21/2024 8:26 AM, chrisq wrote:
    On 8/21/24 02:25, Lawrence D'Oliveiro wrote:
    On Tue, 20 Aug 2024 09:47:36 -0400, Arne Vajh°j wrote:
    Few languages support multiple return values.

    Even in C and Fortran, a function can return a struct.

    Better to declare the struct externally, then pass a pointer
    to it. Much tidier.

    In C one should definitely return a pointer to struct and not

    Problem is that of you return a pointer, that suggests that the
    struct has been declared static inside the called function. That
    would be a fail for reentant code that might be called from
    elsewhere, say, from an interrupt handler, or another thread.
    The struct wouldá typically be on the stack or heap, and would
    disappear on return from the call, making the return value
    invalid. Ideally, in a multitasking os, all code should be
    designed to be fully reentrant, to make it safe in all
    situations.

    My assumption would be that the struct was malloc'ed in
    the function.

    That obvious also has its problem. One can write in
    72 point bold red blinking font that it is the callers
    responsibility to call free and it will still be
    forgotten in some cases.

    Arne


    Just admit that you was wrong and that the best option in C is the same
    as in many other languages - return the structure itself.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Craig A. Berry@21:1/5 to Lawrence D'Oliveiro on Thu Aug 29 07:23:19 2024
    On 8/28/24 8:49 PM, Lawrence D'Oliveiro wrote:
    On Wed, 28 Aug 2024 16:35 +0100 (BST), John Dallman wrote:

    In article <valhi8$34s18$4@dont-email.me>, ldo@nz.invalid (Lawrence
    D'Oliveiro) wrote:

    Perl actually has a vast range of builtins.

    True, but they are at least all in one list. The problem I've had with
    Python is finding what the word is to do a thing.

    I’m not sure I understand that. Python does things by “constructs” rather
    than individual “words”. Do you mean function and class names?

    The extra things you import if you don't have a builtin that does what
    you want are called modules in both Perl and Python. As far as I can
    tell he's just saying that with Perl, the operations he uses most (e.g.
    I/O and regular expressions) are already there as builtins and there are
    no "use" statements necessary to import modules to do those things.

    There are 150+ modules that ship with Perl and thousands more on CPAN,
    and you do need some of them to do some things. But John is right; Perl
    is quite a capable language, sort of an awk on steroids, without those
    things.

    Python also ships with a ton of modules and has many more available via
    pip. But it has moved in the direction of fewer builtins and needing
    modules to do pretty much anything. I think Python 2 had an "open"
    builtin but in Python 3 you have to "import io" and use "io.open." I'm
    sure I will get a lecture on all the computer sciency reasons that's a
    superior way of doing things. But for someone trying to get work done,
    having the tools you use most already out on the workbench without
    having to remember which tool chest they're in can be an advantage.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Arne_Vajh=C3=B8j?=@21:1/5 to Craig A. Berry on Thu Aug 29 08:33:55 2024
    On 8/29/2024 8:23 AM, Craig A. Berry wrote:
    On 8/28/24 8:49 PM, Lawrence D'Oliveiro wrote:
    On Wed, 28 Aug 2024 16:35 +0100 (BST), John Dallman wrote:
    In article <valhi8$34s18$4@dont-email.me>, ldo@nz.invalid (Lawrence
    D'Oliveiro) wrote:
    Perl actually has a vast range of builtins.

    True, but they are at least all in one list. The problem I've had with
    Python is finding what the word is to do a thing.

    I’m not sure I understand that. Python does things by “constructs” rather
    than individual “words”. Do you mean function and class names?

    The extra things you import if you don't have a builtin that does what
    you want are called modules in both Perl and Python.  As far as I can
    tell he's just saying that with Perl, the operations he uses most (e.g.
    I/O and regular expressions) are already there as builtins and there are
    no "use" statements necessary to import modules to do those things.

    There are 150+ modules that ship with Perl and thousands more on CPAN,
    and you do need some of them to do some things.  But John is right; Perl
    is quite a capable language, sort of an awk on steroids, without those things.

    Python also ships with a ton of modules and has many more available via pip.  But it has moved in the direction of fewer builtins and needing modules to do pretty much anything.  I think Python 2 had an "open"
    builtin but in Python 3 you have to "import io" and use "io.open."  I'm
    sure I will get a lecture on all the computer sciency reasons that's a superior way of doing things. But for someone trying to get work done,
    having the tools you use most already out on the workbench without
    having to remember which tool chest they're in can be an advantage.

    open is still listed at:
    https://docs.python.org/3/library/functions.html

    But yes the general trend is to externalize.

    In the J world we saw Java 11 remove JAX-WS and JAXB
    to make them external downloadable packages.

    Arne

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Craig A. Berry on Thu Aug 29 23:09:00 2024
    On Thu, 29 Aug 2024 07:23:19 -0500, Craig A. Berry wrote:

    Python also ships with a ton of modules and has many more available via
    pip. But it has moved in the direction of fewer builtins and needing
    modules to do pretty much anything. I think Python 2 had an "open"
    builtin but in Python 3 you have to "import io" and use "io.open."

    No, Python 2 had both “open” and “file” builtins which did the same thing,
    but Python 3 keeps “open”. Yes, there is an important “io” module if you
    want to get into the lower guts of file objects.

    According to the “What’s New In Python 3.0” notes <https://docs.python.org/3.0/whatsnew/3.0.html>, only about half a dozen builtins were removed.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Simon Clubley@21:1/5 to Lawrence D'Oliveiro on Fri Aug 16 12:07:02 2024
    On 2024-08-15, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
    On Wed, 14 Aug 2024 14:07:31 -0400, Arne Vajh°j wrote:

    However, since you ask, I prefer a writeup rather than a 40 minute
    video for this kind of update ...

    I 100% agree.

    Have you tried playing the video at a higher speed, to get through it quicker?

    That's a hack, not a solution (and there are severe limits to how much incremental time you can save with this approach).

    Written material is a far better solution in this situation.

    Simon.

    --
    Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
    Walking destinations on a map are further away than they appear.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stephen Hoffman@21:1/5 to Craig A. Berry on Fri Aug 16 12:11:16 2024
    On 2024-08-15 01:26:00 +0000, Craig A. Berry said:

    On 8/14/24 7:35 PM, Stephen Hoffman wrote:
    On 2024-08-14 19:49:28 +0000, Robert A. Brooks said:

    On 8/14/2024 2:57 PM, Arne Vajh°j wrote:

    compile/POINTER_SIZE=32, LINK/SEG=CODE=P0 etc. can all help get stuff working.

    But it is not the right long term solution.
    á For C++, the default pointer size should have remained 32.
    It was a mistake to change the default from what it was on Alpha and IA64. >>
    It was a mistake to use 32 and not 64 on Alpha and Itanium, but that
    pain will continue for the foreseeable future.

    It is past time to change the default. I suspect a lot of the
    difficulties in porting are not just from pointer sizes but also
    integer sizes. Specifying "long" because the docs for an API say to
    use a longword is a 40-year-old habit that will be hard to break, and
    not all of the APIs have 64-bit equivalents. A lot of things probably
    assume "long" is the same size as "int" even though that is now no
    longer the case. As far as I know there is no compiler switch to say /DATA_MODEL=ILP32 to override the new default of LP64.


    In the approaches available to apps likely to be ported, cranking up
    the compiler diagnostics settings can find a whole lot of latent bad.
    This even if there isn't an app port in the immediate future.

    Expect that anybody providing maintenance or porting estimates will
    likely increase those estimates for each instance of /VAXC located, for instance.

    The 32-/64-bit addressing design was the right decision at the time.

    That the design worked as well as it's done, and allowed code
    coexistence was and is valuable.

    But we're most of 30 years past Eagle/Theta/V7.0.

    Different times. Different tradeoffs. Different hardware. Different expectations.

    Developers have been adding to the complexity here with new work, too.
    Which isn't a good place.

    If the existing API morass ever gets resolved, flat 64-bit would be preferred.

    Because the whole what-does-it-return and which-call-can-I-use and the size_t/ptrdiff_t mess we ended up with from Eagle/Theta/V7.0 is, well,
    a mess.

    Yes, that means dragging some apps forward. And dragging systen APIs forward.

    It also means an opportunity to age out and deprecate the most
    problematic of the old APIs.

    And it means leaving the old stuff building and running in 32-bit and 32-/64-bit legacy-compatibility mode and for the foreseeable future.

    But any replacement really needs to be further forward than flat 64-bit
    using previous-millennium API designs and coding practices.

    Which gets into discussions of compiler and API overhauls and other
    topics for new 64-bit code.

    As for itemlists and descriptors. Good ideas ~40 years ago. Now, not so much.

    To be absolutely clear, the existing 32-/64-bit morass would have to
    continue in parallel with the 64-bit environment for a decade or so.

    All of which have been discussed before.

    VSI have far larger projects. Which means this "pain will continue for
    the foreseeable future".

    And some perspective: we're a decade farther from Eagle/Theta/V7.0 now
    than Eagle/Theta/V7.0 was from VAX/VMS V1.0.



    --
    Pure Personal Opinion | HoffmanLabs LLC

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dave Froble@21:1/5 to Simon Clubley on Fri Aug 16 13:16:00 2024
    On 8/16/2024 8:07 AM, Simon Clubley wrote:
    On 2024-08-15, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
    On Wed, 14 Aug 2024 14:07:31 -0400, Arne Vajhøj wrote:

    However, since you ask, I prefer a writeup rather than a 40 minute
    video for this kind of update ...

    I 100% agree.

    Have you tried playing the video at a higher speed, to get through it
    quicker?

    That's a hack, not a solution (and there are severe limits to how much incremental time you can save with this approach).

    Written material is a far better solution in this situation.

    Simon.


    People can process written material at their own chosen speed ...

    --
    David Froble Tel: 724-529-0450
    Dave Froble Enterprises, Inc. E-Mail: davef@tsoft-inc.com
    DFE Ultralights, Inc.
    170 Grimplin Road
    Vanderbilt, PA 15486

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Arne_Vajh=C3=B8j?=@21:1/5 to bill on Fri Aug 16 14:56:56 2024
    On 8/16/2024 2:52 PM, bill wrote:
    On 8/16/2024 1:16 PM, Dave Froble wrote:
    On 8/16/2024 8:07 AM, Simon Clubley wrote:
    On 2024-08-15, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
    On Wed, 14 Aug 2024 14:07:31 -0400, Arne Vajhøj wrote:

    However, since you ask, I prefer a writeup rather than a 40 minute >>>>>> video for this kind of update ...

    I 100% agree.

    Have you tried playing the video at a higher speed, to get through it
    quicker?

    That's a hack, not a solution (and there are severe limits to how much
    incremental time you can save with this approach).

    Written material is a far better solution in this situation.

    People can process written material at their own chosen speed ...

    More importantly, how are all you people accessing YouTube under VMS?

    I doubt that any of the very old browsers available for VMS support
    the required JavaScript and video format.

    But the common PC with Windows/Linux/macOS should be able to do it.

    Arne

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From John Dallman@21:1/5 to Robert A. Brooks on Fri Aug 16 21:38:00 2024
    In article <v9j1o8$fql6$3@dont-email.me>, FIRST.LAST@vmssoftware.com
    (Robert A. Brooks) wrote:

    There is a lot of VMS-developed C++ code that expects a pointer
    size of 32, so in the case I cited, that compilation qualifer
    will remain forever, because the code will not change.

    Presumably, most of the open source ported to VMS uses 32-bit pointers?

    John

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Arne_Vajh=C3=B8j?=@21:1/5 to John Dallman on Fri Aug 16 17:17:09 2024
    On 8/16/2024 4:38 PM, John Dallman wrote:
    In article <v9j1o8$fql6$3@dont-email.me>, FIRST.LAST@vmssoftware.com
    (Robert A. Brooks) wrote:
    There is a lot of VMS-developed C++ code that expects a pointer
    size of 32, so in the case I cited, that compilation qualifer
    will remain forever, because the code will not change.

    Presumably, most of the open source ported to VMS uses 32-bit pointers?

    My guess would be that most C++ open source comes from the Linux
    world and is mostly tested with 64 bit pointers.

    Arne

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to All on Sat Aug 17 01:06:20 2024
    On Fri, 16 Aug 2024 17:17:09 -0400, Arne Vajhøj wrote:

    My guess would be that most C++ open source comes from the Linux world
    and is mostly tested with 64 bit pointers.

    A lot of open source is still compatible with both 32-bit and 64-bit
    platforms. Debian, for example, is still available in 32-bit form, and has
    been going through a conversion to 64-bit time_t to avoid the upcoming year-2038 problem.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Stephen Hoffman on Sat Aug 17 01:06:51 2024
    On Fri, 16 Aug 2024 12:11:16 -0400, Stephen Hoffman wrote:

    Yes, that means dragging some apps forward. And dragging systen APIs forward.

    Reinventing POSIX?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Craig A. Berry@21:1/5 to John Dallman on Fri Aug 16 20:22:08 2024
    On 8/16/24 3:38 PM, John Dallman wrote:
    In article <v9j1o8$fql6$3@dont-email.me>, FIRST.LAST@vmssoftware.com
    (Robert A. Brooks) wrote:

    There is a lot of VMS-developed C++ code that expects a pointer
    size of 32, so in the case I cited, that compilation qualifer
    will remain forever, because the code will not change.

    Presumably, most of the open source ported to VMS uses 32-bit pointers?

    Yes, but very little of it is written in C++. Mark Berryman has been
    wrestling with mariadb and xpdf as reported on the VSI forum, but most
    of what has been ported before is just C, not C++.

    I suspect most of the C++ on VMS has been customer code.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Craig A. Berry@21:1/5 to Lawrence D'Oliveiro on Fri Aug 16 20:29:40 2024
    On 8/16/24 8:06 PM, Lawrence D'Oliveiro wrote:
    On Fri, 16 Aug 2024 12:11:16 -0400, Stephen Hoffman wrote:

    Yes, that means dragging some apps forward. And dragging systen APIs
    forward.

    Reinventing POSIX?

    POSIX is just an API. If you have to worry about whether it's a
    "system" API or not, then you're in an environment that doesn't conform
    to the POSIX standard.

    And on VMS dragging system APIs forward just means that calls like
    SYS$FILESCAN have 64-bit as well as 32-bit versions, as many other
    system calls already do.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Craig A. Berry on Sat Aug 17 02:44:32 2024
    On Fri, 16 Aug 2024 20:29:40 -0500, Craig A. Berry wrote:

    On 8/16/24 8:06 PM, Lawrence D'Oliveiro wrote:

    On Fri, 16 Aug 2024 12:11:16 -0400, Stephen Hoffman wrote:

    Yes, that means dragging some apps forward. And dragging systen APIs
    forward.

    Reinventing POSIX?

    POSIX is just an API.

    It was an API that was careful to define higher-level types like “time_t” and “uintptr_t” and “size_t”, precisely because the *nix systems were at
    the forefront of the 64-bit transition and they had to be prepared.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Arne_Vajh=C3=B8j?=@21:1/5 to Michael S on Fri Aug 23 09:02:36 2024
    On 8/23/2024 4:14 AM, Michael S wrote:
    On Thu, 22 Aug 2024 19:21:07 -0400
    Arne Vajhøj <arne@vajhoej.dk> wrote:
    On 8/22/2024 7:12 PM, chrisq wrote:
    On 8/21/24 19:13, Arne Vajhøj wrote:
    On 8/21/2024 8:26 AM, chrisq wrote:
    On 8/21/24 02:25, Lawrence D'Oliveiro wrote:
    On Tue, 20 Aug 2024 09:47:36 -0400, Arne Vajhøj wrote:
    Few languages support multiple return values.

    Even in C and Fortran, a function can return a struct.

    Better to declare the struct externally, then pass a pointer
    to it. Much tidier.

    In C one should definitely return a pointer to struct and not

    Problem is that of you return a pointer, that suggests that the
    struct has been declared static inside the called function. That
    would be a fail for reentant code that might be called from
    elsewhere, say, from an interrupt handler, or another thread.
    The struct would  typically be on the stack or heap, and would
    disappear on return from the call, making the return value
    invalid. Ideally, in a multitasking os, all code should be
    designed to be fully reentrant, to make it safe in all
    situations.

    My assumption would be that the struct was malloc'ed in
    the function.

    That obvious also has its problem. One can write in
    72 point bold red blinking font that it is the callers
    responsibility to call free and it will still be
    forgotten in some cases.

    Just admit that you was wrong

    I am often wrong so that is no big deal.

    and that the best option in C is the same
    as in many other languages - return the structure itself.

    Returning the struct itself result in a copy of the struct. The
    time to do the copy is probably insignificant though.

    Languages like (VMS) Pascal and (VMS) Basic do indeed return
    the record and make the copy.

    But newer languages (on VMS that would mostly be Java and other
    JVM languages but other platforms have more languages in this
    category) would dynamic allocate, return a reference/pointer
    and not worry about free because they use GC.

    I am not quite convinced yet.

    Arne

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stephen Hoffman@21:1/5 to Simon Clubley on Fri Aug 23 11:33:41 2024
    On 2024-08-20 12:04:13 +0000, Simon Clubley said:

    On 2024-08-19, Arne Vajh°j <arne@vajhoej.dk> wrote:

    Or if the application is passing pointers between code compiled with
    different languages/compilers/compiler settings.


    Of course, that is what ABIs are _supposed_ to be for...

    Or Swift and C/C++, or Zig and C/C++, which are intended to interoperate.


    --
    Pure Personal Opinion | HoffmanLabs LLC

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Arne_Vajh=C3=B8j?=@21:1/5 to All on Fri Aug 23 13:03:44 2024
    On 8/23/2024 9:02 AM, Arne Vajhøj wrote:
    On 8/23/2024 4:14 AM, Michael S wrote:
                        and that the best option in C is the same
    as in many other languages - return the structure itself.

    Returning the struct itself result in a copy of the struct. The
    time to do the copy is probably insignificant though.

    I am not quite convinced yet.

    It seems like one frequently provided reason for using pointer
    is ABI compatibility.

    I don't know about that. It is not that easy to create the
    problem.

    But it is possible:

    $ type i.h
    struct data
    {
    int a;
    int b;
    #ifdef NEWVERSION
    int c;
    #endif
    };

    $ type s1.c
    #include "i.h"

    struct data get()
    {
    struct data res;
    res.a = 123;
    res.b = 456;
    #ifdef NEWVERSION
    res.c = 0x7FFFFFFF;
    #endif
    return res;
    }

    $ type m1.c
    #include <stdio.h>

    #include "i.h"

    struct data get();

    int main()
    {
    struct data res = get();
    printf("%d %d\n", res.a, res.b);
    return 0;
    }
    $ type s2.c
    #include <stdlib.h>

    #include "i.h"

    struct data *get()
    {
    struct data *res = malloc(sizeof(struct data));
    res->a = 123;
    res->b = 456;
    #ifdef NEWVERSION
    res->c = 0x7FFFFFFF;
    #endif
    return res;
    }

    $ type m2.c
    #include <stdio.h>
    #include <stdlib.h>

    #include "i.h"

    struct data *get();

    int main()
    {
    struct data *res = get();
    printf("%d %d\n", res->a, res->b);
    free(res);
    return 0;
    }
    $ cc s1
    $ cc m1
    $ link m1 + s1
    $ run m1
    123 456
    $ cc/define="NEWVERSION" s1
    $ link m1 + s1
    $ run m1
    99108 0
    $ cc s2
    $ cc m2
    $ link m2 + s2
    $ run m2
    123 456
    $ cc/define="NEWVERSION" s2
    $ link m2 + s2
    $ run m2
    123 456

    Arne

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Stephen Hoffman on Fri Aug 23 22:56:39 2024
    On Fri, 23 Aug 2024 11:33:41 -0400, Stephen Hoffman wrote:

    On 2024-08-20 12:04:13 +0000, Simon Clubley said:

    On 2024-08-19, Arne Vajhøj <arne@vajhoej.dk> wrote:

    Or if the application is passing pointers between code compiled with
    different languages/compilers/compiler settings.

    Of course, that is what ABIs are _supposed_ to be for...

    Or Swift and C/C++, or Zig and C/C++, which are intended to
    interoperate.

    There is a generic library called libffi to support this sort of thing for
    any language. For example, Python’s ctypes module is built on this.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)