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


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

Re: initializer list type deduction rules

From Juha Nieminen <nospam@thanks.invalid>
Newsgroups comp.lang.c++
Subject Re: initializer list type deduction rules
Date 2022-08-12 11:51 +0000
Organization Aioe.org NNTP Server
Message-ID <td5esq$17mf$1@gioia.aioe.org> (permalink)
References (4 earlier) <tcvo8u$kl5$1@gioia.aioe.org> <td27ab$1v3i$1@gioia.aioe.org> <87zggaeqpw.fsf@bsb.me.uk> <td3nrp$1156$1@gioia.aioe.org> <87edxmcr7p.fsf@bsb.me.uk>

Show all headers | View raw


Ben Bacarisse <ben.usenet@bsb.me.uk> wrote:
>> Yeah, using C's crazy type declaration syntax, which only a fraction
>> C (or C++) programmers fully understand and remember by heart.
> 
> I don't think there are that many people will write
> 
>   using fp = int (*)(int, double);
> 
> but just baulk at
> 
>   typedef int (*fp)(int, double);
> 
> What C calls a "type name" -- the int (*)(int, double) part -- is the
> bit that bothers most people, at least in my limited experience.

If we are stuck with C's crazy type declaration syntax, at least it's
nice if it becomes even slightly easier to read.

In the 'using' version the name of the alias is extremely easy to find
with a quick visual scan, because it always comes after the 'using'
and before the '='. Especially if that's what you are interested in
you can ignore everything that comes after the '='.

In the 'typedef' version you have visually find and dig out the name
of the alias from among all the syntax gibberish. And a straightforward
function pointer type is still simple compared to the craziest and most
complex type declarations. (Consider that a more complicated declaration
may use *other* type aliases within it, so it becomes even harder to
find *this* type alias name with a quick visual scan. You really need
to start deciphering the gibberish to find out which one of the names
is the one you are interested in. In the 'using' version you can just
ignore everything after the '=', no matter how complicated.)

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


Thread

initializer list type deduction rules Juha Nieminen <nospam@thanks.invalid> - 2022-08-09 07:54 +0000
  Re: initializer list type deduction rules Bo Persson <bo@bo-persson.se> - 2022-08-09 10:43 +0200
  Re: initializer list type deduction rules Öö Tiib <ootiib@hot.ee> - 2022-08-09 09:00 -0700
    Re: initializer list type deduction rules Muttley@dastardlyhq.com - 2022-08-09 16:06 +0000
      Re: initializer list type deduction rules Juha Nieminen <nospam@thanks.invalid> - 2022-08-10 02:32 +0000
        Re: initializer list type deduction rules Paavo Helde <eesnimi@osa.pri.ee> - 2022-08-10 09:11 +0300
          Re: initializer list type deduction rules Juha Nieminen <nospam@thanks.invalid> - 2022-08-10 06:57 +0000
        Re: initializer list type deduction rules Muttley@dastardlyhq.com - 2022-08-10 07:31 +0000
      Re: initializer list type deduction rules Öö Tiib <ootiib@hot.ee> - 2022-08-10 00:40 -0700
        Re: initializer list type deduction rules Muttley@dastardlyhq.com - 2022-08-10 07:55 +0000
          Re: initializer list type deduction rules Öö Tiib <ootiib@hot.ee> - 2022-08-10 01:13 -0700
            Re: initializer list type deduction rules Muttley@dastardlyhq.com - 2022-08-10 08:21 +0000
              Re: initializer list type deduction rules Öö Tiib <ootiib@hot.ee> - 2022-08-10 11:13 -0700
                Re: initializer list type deduction rules Muttley@dastardlyhq.com - 2022-08-12 08:26 +0000
                Re: initializer list type deduction rules Öö Tiib <ootiib@hot.ee> - 2022-08-12 03:38 -0700
                Re: initializer list type deduction rules Muttley@dastardlyhq.com - 2022-08-12 10:48 +0000
                Re: initializer list type deduction rules Öö Tiib <ootiib@hot.ee> - 2022-08-12 04:54 -0700
                Re: initializer list type deduction rules Muttley@dastardlyhq.com - 2022-08-12 14:34 +0000
                Re: initializer list type deduction rules Öö Tiib <ootiib@hot.ee> - 2022-08-12 08:34 -0700
                Re: initializer list type deduction rules Muttley@dastardlyhq.com - 2022-08-12 15:57 +0000
                Re: initializer list type deduction rules Öö Tiib <ootiib@hot.ee> - 2022-08-12 09:16 -0700
                Re: initializer list type deduction rules Muttley@dastardlyhq.com - 2022-08-13 09:35 +0000
                Re: initializer list type deduction rules Öö Tiib <ootiib@hot.ee> - 2022-08-13 09:44 -0700
                Re: initializer list type deduction rules Muttley@dastardlyhq.com - 2022-08-14 11:12 +0000
                Re: initializer list type deduction rules scott@slp53.sl.home (Scott Lurndal) - 2022-08-12 14:58 +0000
                Re: initializer list type deduction rules Öö Tiib <ootiib@hot.ee> - 2022-08-12 08:59 -0700
                Re: initializer list type deduction rules Muttley@dastardlyhq.com - 2022-08-12 16:11 +0000
                Re: initializer list type deduction rules scott@slp53.sl.home (Scott Lurndal) - 2022-08-12 16:44 +0000
                Re: initializer list type deduction rules Öö Tiib <ootiib@hot.ee> - 2022-08-12 12:08 -0700
                Re: initializer list type deduction rules scott@slp53.sl.home (Scott Lurndal) - 2022-08-12 19:58 +0000
                Re: initializer list type deduction rules Öö Tiib <ootiib@hot.ee> - 2022-08-12 16:42 -0700
                Re: initializer list type deduction rules David Brown <david.brown@hesbynett.no> - 2022-08-13 18:14 +0200
                Re: initializer list type deduction rules Muttley@dastardlyhq.com - 2022-08-14 11:06 +0000
                Re: initializer list type deduction rules David Brown <david.brown@hesbynett.no> - 2022-08-15 11:34 +0200
                Re: initializer list type deduction rules Muttley@dastardlyhq.com - 2022-08-15 19:03 +0000
                Re: initializer list type deduction rules David Brown <david.brown@hesbynett.no> - 2022-08-15 21:23 +0200
                Re: initializer list type deduction rules red floyd <no.spam.here@its.invalid> - 2022-08-15 13:51 -0700
                Re: initializer list type deduction rules Muttley@dastardlyhq.com - 2022-08-16 19:16 +0000
                Re: initializer list type deduction rules Paavo Helde <eesnimi@osa.pri.ee> - 2022-08-21 22:23 +0300
                Re: initializer list type deduction rules David Brown <david.brown@hesbynett.no> - 2022-08-22 08:08 +0200
                Re: initializer list type deduction rules Paavo Helde <eesnimi@osa.pri.ee> - 2022-08-22 11:37 +0300
                Re: initializer list type deduction rules Muttley@dastardlyhq.com - 2022-08-22 10:23 +0000
          Re: initializer list type deduction rules Juha Nieminen <nospam@thanks.invalid> - 2022-08-11 06:24 +0000
            Re: initializer list type deduction rules Ben Bacarisse <ben.usenet@bsb.me.uk> - 2022-08-11 16:37 +0100
              Re: initializer list type deduction rules Juha Nieminen <nospam@thanks.invalid> - 2022-08-11 20:12 +0000
                Re: initializer list type deduction rules Ben Bacarisse <ben.usenet@bsb.me.uk> - 2022-08-12 00:09 +0100
                Re: initializer list type deduction rules Juha Nieminen <nospam@thanks.invalid> - 2022-08-12 11:51 +0000
            Re: initializer list type deduction rules Muttley@dastardlyhq.com - 2022-08-12 08:29 +0000
              Re: initializer list type deduction rules Juha Nieminen <nospam@thanks.invalid> - 2022-08-12 12:08 +0000
                Re: initializer list type deduction rules Muttley@dastardlyhq.com - 2022-08-12 14:37 +0000
                Re: initializer list type deduction rules scott@slp53.sl.home (Scott Lurndal) - 2022-08-12 15:01 +0000
                Re: initializer list type deduction rules Juha Nieminen <nospam@thanks.invalid> - 2022-08-15 06:04 +0000
  Re: initializer list type deduction rules Andrey Tarasevich <andreytarasevich@hotmail.com> - 2022-08-09 16:08 -0700
    Re: initializer list type deduction rules Juha Nieminen <nospam@thanks.invalid> - 2022-08-10 02:34 +0000

csiph-web