Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #82879

Re: Hello World in Russian

From "Alf P. Steinbach" <alf.p.steinbach@gmail.com>
Newsgroups comp.lang.c++
Subject Re: Hello World in Russian
Date 2022-01-30 21:53 +0100
Organization A noiseless patient Spider
Message-ID <st6ts7$g01$1@dont-email.me> (permalink)
References (2 earlier) <st3n3o$cn4$1@dont-email.me> <st5hll$ppo$1@dont-email.me> <87tudle826.fsf@bsb.me.uk> <st628v$als$1@dont-email.me> <87o83te0yh.fsf@bsb.me.uk>

Show all headers | View raw


On 30 Jan 2022 15:45, Ben Bacarisse wrote:
> 
> Not sure what the "so" is about.  You appeared to be blaming the C and
> C++ standard for not allowing cat to be written on Windows.  I blame the
> Windows standard library for not supporting freopen.

No, I used it as an example of a consequence of the unreasonable design.

With a more sane design with access to the raw bytes, the problem 
wouldn't have existed, regardless of buggy or perfect `freopen`.

Still you have a point in that I gave that example based on just old 
memories. So now I added code to actually copy input to output (getchar 
+ putchar). Still fails in Windows with both Visual C++ and MinGW g++ 
for both portable and Windows-specific `freopen` args, but works in WSL 
Ubuntu for portable:


[C:\root\temp]
 > bash
alf@Alf-Windows-PC:/mnt/c/root/temp$ rm *.exe
alf@Alf-Windows-PC:/mnt/c/root/temp$ g++ -std++17 x.cpp
g++: error: unrecognized command line option ‘-std++17’; did you mean 
‘-std=c++17’?
alf@Alf-Windows-PC:/mnt/c/root/temp$ g++ -std=c++17 x.cpp
alf@Alf-Windows-PC:/mnt/c/root/temp$ echo blah | ./a.out
Windows-specific code
!freopen(stdin) failed
alf@Alf-Windows-PC:/mnt/c/root/temp$ g++ -std=c++17 x.cpp -D PORTABLE
alf@Alf-Windows-PC:/mnt/c/root/temp$ echo blah | ./a.out
Portable code
blah


That's sort of a Pyrrhic victory for the standard library design, that 
this thing that could save the day in Windows or at least be claimed to 
be the intended way to do things, works in Ubuntu where it's not needed.

Anyway. :-)


- Alf [too lazy to fix the Ubuntu prompt]

Back to comp.lang.c++ | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Hello World in Russian Joseph Hesse <joeh@gmail.com> - 2022-01-29 05:51 +0200
  Re: Hello World in Russian James Kuyper <jameskuyper@alumni.caltech.edu> - 2022-01-28 23:27 -0500
    Re: Hello World in Russian Muttley@dastardlyhq.com - 2022-01-29 10:21 +0000
  Re: Hello World in Russian Andrey Tarasevich <andreytarasevich@hotmail.com> - 2022-01-28 22:42 -0800
    Re: Hello World in Russian David Brown <david.brown@hesbynett.no> - 2022-01-29 13:01 +0100
      Re: Hello World in Russian "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2022-01-29 14:12 +0100
        Re: Hello World in Russian David Brown <david.brown@hesbynett.no> - 2022-01-29 17:34 +0100
      Re: Hello World in Russian James Kuyper <jameskuyper@alumni.caltech.edu> - 2022-01-30 14:17 -0500
        Re: Hello World in Russian Andrey Tarasevich <andreytarasevich@hotmail.com> - 2022-01-30 20:17 -0800
  Re: Hello World in Russian "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2022-01-29 11:48 +0100
    Re: Hello World in Russian Paavo Helde <eesnimi@osa.pri.ee> - 2022-01-29 17:39 +0200
      Re: Hello World in Russian "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2022-01-30 09:18 +0100
        Re: Hello World in Russian Ben Bacarisse <ben.usenet@bsb.me.uk> - 2022-01-30 12:12 +0000
          Re: Hello World in Russian "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2022-01-30 14:02 +0100
            Re: Hello World in Russian Ben Bacarisse <ben.usenet@bsb.me.uk> - 2022-01-30 14:45 +0000
              Re: Hello World in Russian "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2022-01-30 21:53 +0100
                Re: Hello World in Russian Ben Bacarisse <ben.usenet@bsb.me.uk> - 2022-01-30 21:00 +0000
            Re: Hello World in Russian James Kuyper <jameskuyper@alumni.caltech.edu> - 2022-01-30 14:02 -0500
          Re: Hello World in Russian Muttley@dastardlyhq.com - 2022-01-31 10:23 +0000
            Re: Hello World in Russian scott@slp53.sl.home (Scott Lurndal) - 2022-01-31 16:11 +0000
              Re: Hello World in Russian Muttley@dastardlyhq.com - 2022-01-31 16:36 +0000
              Re: Hello World in Russian Paavo Helde <eesnimi@osa.pri.ee> - 2022-01-31 20:20 +0200
            Re: Hello World in Russian Ben Bacarisse <ben.usenet@bsb.me.uk> - 2022-01-31 16:12 +0000
              Re: Hello World in Russian Muttley@dastardlyhq.com - 2022-01-31 16:39 +0000
                Re: Hello World in Russian Ben Bacarisse <ben.usenet@bsb.me.uk> - 2022-01-31 23:47 +0000
        Re: Hello World in Russian Manfred <noname@add.invalid> - 2022-01-31 16:45 +0100
        Re: Hello World in Russian Andrey Tarasevich <andreytarasevich@hotmail.com> - 2022-01-31 10:10 -0800
          Re: Hello World in Russian "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2022-01-31 19:25 +0100
      Re: Hello World in Russian Marcel Mueller <news.5.maazl@spamgourmet.org> - 2022-01-30 12:09 +0100
        Re: Hello World in Russian Paavo Helde <eesnimi@osa.pri.ee> - 2022-01-30 14:26 +0200
          Re: Hello World in Russian Richard Damon <Richard@Damon-Family.org> - 2022-01-30 08:59 -0500
            Re: Hello World in Russian Paavo Helde <eesnimi@osa.pri.ee> - 2022-01-30 18:21 +0200
              Re: Hello World in Russian Richard Damon <Richard@Damon-Family.org> - 2022-01-30 12:56 -0500
                Re: Hello World in Russian Vir Campestris <vir.campestris@invalid.invalid> - 2022-02-07 21:05 +0000

csiph-web