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


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

Re: C++ (and some C) quiz questions

From Christian Gollwitzer <auriocus@gmx.de>
Newsgroups comp.lang.c++
Subject Re: C++ (and some C) quiz questions
Date 2022-05-17 08:24 +0200
Organization A noiseless patient Spider
Message-ID <t5vf2f$sop$1@dont-email.me> (permalink)
References (3 earlier) <t5u6uh$e6l$1@dont-email.me> <t5ua8a$1tb9$1@gioia.aioe.org> <t5ub23$e9h$1@dont-email.me> <t5uh6s$p0i$1@dont-email.me> <87o7zxqcfw.fsf@bsb.me.uk>

Show all headers | View raw


Am 17.05.22 um 01:34 schrieb Ben:
> Paavo Helde <eesnimi@osa.pri.ee> writes:
> 
>> 16.05.2022 23:09 Christian Gollwitzer kirjutas:
>>> BTW, in old C when the types were omitted, it was implicit int. How
>>> about "implicit auto" for today? That way, one could write
>>>       x = 0.1L;
>>> or
>>>       f(x, y) {
>>>           return 3*x+y;
>>>       }
>>> to get a templated function with type inference and get closer to modern
>>> languages?
>>
>> You mean sloppy languages, not modern. At the same time, these sloppy
>> languages are currently trying to move closer to strictly typed
>> languages, as - surprise-surprise - sloppy code is not so easy to
>> maintain. That's why you can now write e.g. in Python things like
> 
> I doubt CG was referring to Python since it does no type inference.  He
> may be thinking of languages like Haskell that are strongly typed but
> include very effective type inference.

Yes, indeed, I was thinking about other languages with static typing 
(Python does have strong typing, but it's dynamic). For example, have a 
look at Nim: https://nim-lang.org/

It looks similar to Python, but it uses type inferencing to deduce the 
type of a variable from the first assignment. Hence, it is statically 
compiled and achieves the same overall performance.

To distinguish variable declaration and assignment, Nim uses "var". "var 
x = 0" declares a new variable initialized to 0 whereas "x=0" assigns 
zero. This is not unlike, in current C++ "auto x= 0" and "x=0" would 
work - even though "auto" is a very srange keyword for that.


	Christian

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


Thread

C++ (and some C) quiz questions Juha Nieminen <nospam@thanks.invalid> - 2022-05-16 11:21 +0000
  Re: C++ (and some C) quiz questions Paavo Helde <eesnimi@osa.pri.ee> - 2022-05-16 17:35 +0300
    Re: C++ (and some C) quiz questions Juha Nieminen <nospam@thanks.invalid> - 2022-05-16 16:13 +0000
  Re: C++ (and some C) quiz questions Andrey Tarasevich <andreytarasevich@hotmail.com> - 2022-05-16 10:49 -0700
  Re: C++ (and some C) quiz questions Christian Gollwitzer <auriocus@gmx.de> - 2022-05-16 20:02 +0200
    Re: C++ (and some C) quiz questions "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2022-05-16 20:51 +0200
      Re: C++ (and some C) quiz questions Christian Gollwitzer <auriocus@gmx.de> - 2022-05-16 20:59 +0200
        Re: C++ (and some C) quiz questions Manfred <noname@add.invalid> - 2022-05-16 21:55 +0200
          Re: C++ (and some C) quiz questions Christian Gollwitzer <auriocus@gmx.de> - 2022-05-16 22:09 +0200
            Re: C++ (and some C) quiz questions Andrey Tarasevich <andreytarasevich@hotmail.com> - 2022-05-16 13:47 -0700
              Re: C++ (and some C) quiz questions Ben <ben.usenet@bsb.me.uk> - 2022-05-16 22:19 +0100
                Re: C++ (and some C) quiz questions Andrey Tarasevich <andreytarasevich@hotmail.com> - 2022-05-16 14:52 -0700
                Re: C++ (and some C) quiz questions Ben <ben.usenet@bsb.me.uk> - 2022-05-16 22:57 +0100
            Re: C++ (and some C) quiz questions Paavo Helde <eesnimi@osa.pri.ee> - 2022-05-17 00:54 +0300
              Re: C++ (and some C) quiz questions Ben <ben.usenet@bsb.me.uk> - 2022-05-17 00:34 +0100
                Re: C++ (and some C) quiz questions Christian Gollwitzer <auriocus@gmx.de> - 2022-05-17 08:24 +0200
                Re: C++ (and some C) quiz questions Juha Nieminen <nospam@thanks.invalid> - 2022-05-17 08:21 +0000
                Re: C++ (and some C) quiz questions Ben <ben.usenet@bsb.me.uk> - 2022-05-17 11:06 +0100
        Re: C++ (and some C) quiz questions Juha Nieminen <nospam@thanks.invalid> - 2022-05-17 04:41 +0000
          Re: C++ (and some C) quiz questions Ben <ben.usenet@bsb.me.uk> - 2022-05-17 11:12 +0100
            Re: C++ (and some C) quiz questions Paavo Helde <eesnimi@osa.pri.ee> - 2022-05-17 14:37 +0300
              Re: C++ (and some C) quiz questions Ben <ben.usenet@bsb.me.uk> - 2022-05-17 14:31 +0100
            Re: C++ (and some C) quiz questions Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-05-17 04:53 -0700
              Re: C++ (and some C) quiz questions Juha Nieminen <nospam@thanks.invalid> - 2022-05-18 04:40 +0000
                Re: C++ (and some C) quiz questions Manfred <noname@add.invalid> - 2022-05-18 13:29 +0200
                Re: C++ (and some C) quiz questions Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-05-18 06:57 -0700
                Re: C++ (and some C) quiz questions Paavo Helde <eesnimi@osa.pri.ee> - 2022-05-18 17:37 +0300
                Re: C++ (and some C) quiz questions Juha Nieminen <nospam@thanks.invalid> - 2022-05-19 14:43 +0000
                Re: C++ (and some C) quiz questions Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-05-19 08:21 -0700
                Re: C++ (and some C) quiz questions Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-05-18 06:01 -0700

csiph-web