• Upcoming gfortran 15 will contain unsigned numbers

    From Thomas Koenig@21:1/5 to All on Sun Oct 13 09:52:15 2024
    Hello world,

    J3 has passed https://j3-fortran.org/doc/year/24/24-116.txt , a
    proposal for unsigned numbers in Fortran, in their February/March
    meeting.

    Gfortran 15, to be released in the beginning of 2025, will contain
    an experimental implementation of that proposal. The current
    development version already has that documentation, so if you
    are so inclined, you can download and compile it for yourself to
    try it out already.

    This feature can be accessed by using the -funsigned flag.
    Some short documentation can be found at

    https://gcc.gnu.org/onlinedocs/gfortran/Unsigned-integers.html

    Test cases (also doubling as use examples) can be found at https://gcc.gnu.org/git/?p=gcc.git;a=tree;f=gcc/testsuite/gfortran.dg
    (any file that has "unsigned" in its name).

    Bug reports and comments are welcome.

    Enjoy!

    Best regards

    Thomas

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Gary Scott@21:1/5 to Thomas Koenig on Sun Oct 13 09:09:22 2024
    On 10/13/2024 4:52 AM, Thomas Koenig wrote:
    Hello world,

    J3 has passed https://j3-fortran.org/doc/year/24/24-116.txt , a
    proposal for unsigned numbers in Fortran, in their February/March
    meeting.

    Gfortran 15, to be released in the beginning of 2025, will contain
    an experimental implementation of that proposal. The current
    development version already has that documentation, so if you
    are so inclined, you can download and compile it for yourself to
    try it out already.

    This feature can be accessed by using the -funsigned flag.
    Some short documentation can be found at

    https://gcc.gnu.org/onlinedocs/gfortran/Unsigned-integers.html

    Test cases (also doubling as use examples) can be found at https://gcc.gnu.org/git/?p=gcc.git;a=tree;f=gcc/testsuite/gfortran.dg
    (any file that has "unsigned" in its name).

    Bug reports and comments are welcome.

    Enjoy!

    Best regards

    Thomas
    Yay? :) I'm so used to using larger signed integers and various tricks
    that I'll probably never use it, but at least I have the option now.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Thomas Koenig on Sun Oct 13 21:04:36 2024
    On Sun, 13 Oct 2024 09:52:15 -0000 (UTC), Thomas Koenig wrote:

    J3 has passed https://j3-fortran.org/doc/year/24/24-116.txt , a
    proposal for unsigned numbers in Fortran ...

    Do you mean “unsigned integers”?

    https://gcc.gnu.org/onlinedocs/gfortran/Unsigned-integers.html

    Thought so.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Steven G. Kargl@21:1/5 to Lynn McGuire on Tue Oct 15 20:46:59 2024
    On Tue, 15 Oct 2024 15:26:42 -0500, Lynn McGuire wrote:


    Any plans to support UTF16 or UTF8 in gfortran ?


    gfortran has supported UTF-8 for long time now. Here's
    an example from the manual.


    program character_kind
    use iso_fortran_env
    implicit none
    integer, parameter :: ascii = selected_char_kind ("ascii")
    integer, parameter :: ucs4 = selected_char_kind ('ISO_10646')

    character(kind=ascii, len=26) :: alphabet
    character(kind=ucs4, len=30) :: hello_world

    alphabet = ascii_"abcdefghijklmnopqrstuvwxyz"
    hello_world = ucs4_'Hello World and Ni Hao -- ' &
    // char (int (z'4F60'), ucs4) &
    // char (int (z'597D'), ucs4)

    write (*,*) alphabet

    open (output_unit, encoding='UTF-8')
    write (*,*) trim (hello_world)
    end program character_kind

    --
    steve

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Lynn McGuire on Tue Oct 15 22:35:36 2024
    On Tue, 15 Oct 2024 15:26:42 -0500, Lynn McGuire wrote:

    Any plans to support UTF16 or UTF8 in gfortran ?

    No UTF-16, please!

    That was just a horrible backward-compatibility hack for the sake of those platforms (*cough* Java, Windows NT *cough*) that embraced Unicode as
    their native encoding just a little too soon.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Thomas Koenig@21:1/5 to Lynn McGuire on Sat Nov 9 11:57:41 2024
    Lynn McGuire <lynnmcguire5@gmail.com> schrieb:
    On 10/15/2024 5:35 PM, Lawrence D'Oliveiro wrote:
    On Tue, 15 Oct 2024 15:26:42 -0500, Lynn McGuire wrote:

    Any plans to support UTF16 or UTF8 in gfortran ?

    No UTF-16, please!

    That was just a horrible backward-compatibility hack for the sake of those >> platforms (*cough* Java, Windows NT *cough*) that embraced Unicode as
    their native encoding just a little too soon.

    Aren't all of the Unix and Linux boxen either UTF-16 or UTF-32 ?

    Most certainly not:

    $ echo $LANG
    de_DE.UTF-8

    Haven't seen anything but UTF-8 in a long time.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Lynn McGuire on Sat Nov 9 04:37:37 2024
    On Fri, 8 Nov 2024 21:00:55 -0600, Lynn McGuire wrote:

    Aren't all of the Unix and Linux boxen either UTF-16 or UTF-32 ?

    No!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Lynn McGuire on Sat Nov 23 02:08:19 2024
    On Fri, 22 Nov 2024 19:40:19 -0600, Lynn McGuire wrote:

    Come over here to Windows. UTF-16 is the name of the game. It is a
    total pain.

    Microsoft (and Sun, with Java) adopted Unicode at precisely the wrong
    time, back when everybody believed the Unicode folks who said that it
    would remain a fixed-length 16-bit code.

    Microsoft is rumored to be working on a UTF-8 API for Win32 / Win64. I
    will believe it when I see it.

    Linux simply ignored the issue. Filespecs passed to the kernel are split
    at ASCII “/” characters and terminated by NUL. And those are the only byte values with special interpretations; file/directory names are free to
    contain anything else. As a result, it works seamlessly with UTF-8.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Thomas Koenig@21:1/5 to Lynn McGuire on Sat Nov 23 08:04:06 2024
    Lynn McGuire <lynnmcguire5@gmail.com> schrieb:
    On 11/9/2024 5:57 AM, Thomas Koenig wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> schrieb:
    On 10/15/2024 5:35 PM, Lawrence D'Oliveiro wrote:
    On Tue, 15 Oct 2024 15:26:42 -0500, Lynn McGuire wrote:

    Any plans to support UTF16 or UTF8 in gfortran ?

    No UTF-16, please!

    That was just a horrible backward-compatibility hack for the sake of those >>>> platforms (*cough* Java, Windows NT *cough*) that embraced Unicode as
    their native encoding just a little too soon.

    Aren't all of the Unix and Linux boxen either UTF-16 or UTF-32 ?

    Most certainly not:

    $ echo $LANG
    de_DE.UTF-8

    Haven't seen anything but UTF-8 in a long time.

    Come over here to Windows.

    I should have qualified that with "on Linux".

    UTF-16 is the name of the game. It is a
    total pain.

    I can well believe that.

    At least Fortran has standard methods of using UTF-8.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Wolfgang Agnes@21:1/5 to Lynn McGuire on Sat Nov 23 09:18:11 2024
    Lynn McGuire <lynnmcguire5@gmail.com> writes:

    On 11/9/2024 5:57 AM, Thomas Koenig wrote:

    [...]

    Most certainly not:
    $ echo $LANG
    de_DE.UTF-8
    Haven't seen anything but UTF-8 in a long time.

    Come over here to Windows. UTF-16 is the name of the game. It is a
    total pain.

    How about UCS-2? Have you seen it? I find UCS-2 when I use
    write-sequence from Common Lisp on the Windows Console.

    Microsoft is rumored to be working on a UTF-8 API for Win32 / Win64.
    I will believe it when I see it.

    Same here.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Wolfgang Agnes on Sat Nov 23 22:09:39 2024
    On Sat, 23 Nov 2024 09:18:11 -0300, Wolfgang Agnes wrote:

    How about UCS-2?

    “UCS-2” was the name of the encoding back when it was assumed that Unicode was always going to be just 16 bits. After the coding was extended, those “surrogate” ranges were introduced, to allow representation of the extra characters within a 16-bit encoding, and so “UCS-2” was renamed to “UTF-16”.

    In short, “UTF-16” is basically “UCS-2 with surrogates”.

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