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


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

Re: Two silly problems

From boltar@nowhere.org
Newsgroups comp.lang.c++
Subject Re: Two silly problems
Date 2019-12-28 16:30 +0000
Organization Aioe.org NNTP Server
Message-ID <qu7vvs$129g$1@gioia.aioe.org> (permalink)
References <qu2kmo$6f4$1@dont-email.me> <h6k3g7Fp6iaU1@mid.individual.net> <5SKNF.20703$vj3.18073@fx10.dcg>

Show all headers | View raw


On Sat, 28 Dec 2019 15:51:29 +0000
Mr Flibble <flibble@i42.removethisbit.co.uk> wrote:
>On 28/12/2019 06:37, Alf P. Steinbach wrote:
>> Here the two functions manage to create a local variable called `board`, 
>> of the exact same type in the code as by your argumentation you would 
>> have written it, and in corresponding code by me.
>> 
>> In the assumed-like-Leigh code the `std::` qualification and the type 
>> builder `array` is repeated ad nauseam, because you argue that even when 
>> it's known that all textual instances are a given text it should better 
>> be spelled out; and the focus, what's communicated to a reader, is on 
>> the details of the data representation and not on what it models.
>> 
>> In the more DRY (Don't Repeat Yourself) Alf code the relevant namespace 
>> `std::` is mentioned only once; the type builder `array` is mentioned 
>> only in a `using` declaration and for the two types that it builds here, 
>> that is, three times; and the focus, what's communicated to a reader, is 
>> on what the structure models.
>
>Alf, using deliberate exaggeration to try to invalidate a person's 
>argument is disingenuous at best but I am sure you know this.
>
>void real_leigh()
>{
>     std::size_t const width     = 8;
>     std::size_t const height    = width;
>
>     using row       = std::array<int, width>;
>     using board     = std::array<row, height>;
>
>     Board board{};
>     (void) board; // Whatever
>}

Or since board is just storing ints you could both make it even simpler still 
using C99:

	size_t const width     = 8;
	size_t const height    = width;

	typedef int Board[width][height];
	Board board;

Just saying.

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


Thread

Two silly problems "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2019-12-26 16:47 +0100
  Re: Two silly problems "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2019-12-26 16:51 +0100
  Re: Two silly problems Bo Persson <bo@bo-persson.se> - 2019-12-26 16:55 +0100
    Re: Two silly problems "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2019-12-27 05:07 +0100
      Re: Two silly problems Mr Flibble <flibble@i42.removethisbit.co.uk> - 2019-12-27 16:38 +0000
        Re: Two silly problems "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2019-12-27 20:05 +0100
          Re: Two silly problems Mr Flibble <flibble@i42.removethisbit.co.uk> - 2019-12-28 00:42 +0000
            Re: Two silly problems "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2019-12-28 07:37 +0100
              Re: Two silly problems Mr Flibble <flibble@i42.removethisbit.co.uk> - 2019-12-28 15:51 +0000
                Re: Two silly problems boltar@nowhere.org - 2019-12-28 16:30 +0000
                Re: Two silly problems Mr Flibble <flibble@i42.removethisbit.co.uk> - 2019-12-28 17:15 +0000

csiph-web