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


Groups > comp.lang.c++ > #84323 > unrolled thread

Wikipedia

Started byBonita Montero <Bonita.Montero@gmail.com>
First post2022-05-29 02:59 +0200
Last post2022-06-01 18:39 +0200
Articles 20 on this page of 157 — 19 participants

Back to article view | Back to comp.lang.c++


Contents

  Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-05-29 02:59 +0200
    Re: Wikipedia Juha Nieminen <nospam@thanks.invalid> - 2022-05-29 05:46 +0000
      Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-05-29 08:03 +0200
        Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-05-29 08:34 +0200
        Re: Wikipedia Öö Tiib <ootiib@hot.ee> - 2022-05-29 01:36 -0700
          Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-05-29 10:37 +0200
            Re: Wikipedia Öö Tiib <ootiib@hot.ee> - 2022-05-29 02:09 -0700
              Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-05-29 11:16 +0200
                Re: Wikipedia Öö Tiib <ootiib@hot.ee> - 2022-05-29 03:08 -0700
                  Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-05-29 12:44 +0200
                Re: Wikipedia Paavo Helde <eesnimi@osa.pri.ee> - 2022-05-29 16:05 +0300
                  Re: Wikipedia Freethinker <freethinker@mymail.com> - 2022-05-29 15:19 +0200
                  Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-05-29 15:27 +0200
                    Re: Wikipedia Manu Raju <MR@invalid.invalid> - 2022-05-29 17:26 +0100
                      Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-05-29 19:18 +0200
                      Re: Wikipedia scott@slp53.sl.home (Scott Lurndal) - 2022-05-29 17:49 +0000
                      Re: Wikipedia Manfred <noname@add.invalid> - 2022-05-30 00:25 +0200
                        Re: Wikipedia Popping Mad <rainbow@colition.gov> - 2022-06-04 13:00 -0400
                          Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-04 19:19 +0200
              Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-05-29 11:48 +0200
            Re: Wikipedia Juha Nieminen <nospam@thanks.invalid> - 2022-05-30 06:06 +0000
              Re: Wikipedia Popping Mad <rainbow@colition.gov> - 2022-06-04 13:02 -0400
      Re: Wikipedia Manu Raju <MR@invalid.invalid> - 2022-05-29 17:18 +0100
        Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-05-29 18:22 +0200
          Re: Wikipedia Juha Nieminen <nospam@thanks.invalid> - 2022-05-30 06:08 +0000
            Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-05-31 04:41 +0200
        Re: Wikipedia Juha Nieminen <nospam@thanks.invalid> - 2022-05-30 06:06 +0000
    Re: Wikipedia Mr Flibble <flibble@reddwarf.jmc.corp> - 2022-05-30 19:31 +0100
    Re: Wikipedia Mr Flibble <flibble@reddwarf.jmc.corp> - 2022-05-30 19:52 +0100
      Re: Wikipedia Manfred <noname@add.invalid> - 2022-05-31 14:34 +0200
        Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-05-31 15:15 +0200
          Re: Wikipedia Mr Flibble <flibble@reddwarf.jmc.corp> - 2022-05-31 18:00 +0100
            Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-05-31 19:06 +0200
              Re: Wikipedia Mr Flibble <flibble@reddwarf.jmc.corp> - 2022-05-31 18:43 +0100
                Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-05-31 19:48 +0200
                  Re: Wikipedia David Brown <david.brown@hesbynett.no> - 2022-06-01 09:26 +0200
                    Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-01 09:44 +0200
                      Re: Wikipedia Öö Tiib <ootiib@hot.ee> - 2022-06-01 01:47 -0700
                        Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-01 13:53 +0200
                          Re: Wikipedia David Brown <david.brown@hesbynett.no> - 2022-06-01 17:05 +0200
                            Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-01 17:06 +0200
                          Re: Wikipedia Juha Nieminen <nospam@thanks.invalid> - 2022-06-02 04:57 +0000
                            Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-02 07:43 +0200
                              Re: Wikipedia Juha Nieminen <nospam@thanks.invalid> - 2022-06-02 08:53 +0000
                                Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-02 12:56 +0200
                                  Re: Wikipedia Juha Nieminen <nospam@thanks.invalid> - 2022-06-02 12:46 +0000
                                    Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-02 14:56 +0200
                                      Re: Wikipedia Juha Nieminen <nospam@thanks.invalid> - 2022-06-03 04:14 +0000
                                        Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-03 06:19 +0200
                                          Re: Wikipedia Juha Nieminen <nospam@thanks.invalid> - 2022-06-03 04:26 +0000
                                          Re: Wikipedia Mr Flibble <flibble@reddwarf.jmc.corp> - 2022-06-03 14:22 +0100
                                            Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-03 15:34 +0200
                                            Re: Wikipedia "daniel...@gmail.com" <danielaparker@gmail.com> - 2022-06-03 07:24 -0700
                                              Re: Wikipedia Juha Nieminen <nospam@thanks.invalid> - 2022-06-03 14:56 +0000
                                                Re: Wikipedia "daniel...@gmail.com" <danielaparker@gmail.com> - 2022-06-03 08:06 -0700
                                                  Re: Wikipedia David Brown <david.brown@hesbynett.no> - 2022-06-03 17:30 +0200
                                                    Re: Wikipedia "daniel...@gmail.com" <danielaparker@gmail.com> - 2022-06-03 10:37 -0700
                                                      Re: Wikipedia David Brown <david.brown@hesbynett.no> - 2022-06-03 20:33 +0200
                                                        Re: Wikipedia scott@slp53.sl.home (Scott Lurndal) - 2022-06-03 18:59 +0000
                                                          Re: Wikipedia "daniel...@gmail.com" <danielaparker@gmail.com> - 2022-06-03 12:35 -0700
                                                          Re: Wikipedia Freethinker <freethinker@mymail.com> - 2022-06-03 23:42 +0200
                                                            Re: Wikipedia Muttley@dastardlyhq.com - 2022-06-04 08:10 +0000
                                                        Re: Wikipedia "daniel...@gmail.com" <danielaparker@gmail.com> - 2022-06-03 11:59 -0700
                                                          Re: Wikipedia David Brown <david.brown@hesbynett.no> - 2022-06-04 15:27 +0200
                                                  Re: Wikipedia Juha Nieminen <nospam@thanks.invalid> - 2022-06-04 15:31 +0000
                                              Re: Wikipedia Manfred <noname@add.invalid> - 2022-06-03 17:02 +0200
                                                Re: Wikipedia "daniel...@gmail.com" <danielaparker@gmail.com> - 2022-06-03 08:11 -0700
                                              Re: Wikipedia "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-06-03 14:23 -0700
                                    Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-02 14:58 +0200
                                    Re: Wikipedia Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-06-04 08:00 -0700
                                  Re: Wikipedia David Brown <david.brown@hesbynett.no> - 2022-06-02 16:00 +0200
                                    Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-02 16:09 +0200
                                      Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-02 16:14 +0200
                                  Re: Wikipedia Popping Mad <rainbow@colition.gov> - 2022-06-04 13:20 -0400
                                    Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-04 19:23 +0200
                                Re: Wikipedia Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2022-06-02 04:40 -0700
                                  Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-02 14:00 +0200
                                    Re: Wikipedia Juha Nieminen <nospam@thanks.invalid> - 2022-06-02 12:47 +0000
                                      Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-02 14:59 +0200
                                        Re: Wikipedia Juha Nieminen <nospam@thanks.invalid> - 2022-06-03 04:17 +0000
                                          Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-03 06:20 +0200
                                            Re: Wikipedia Juha Nieminen <nospam@thanks.invalid> - 2022-06-03 04:27 +0000
                                  Re: Wikipedia David Brown <david.brown@hesbynett.no> - 2022-06-02 16:13 +0200
                                    Re: Wikipedia Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2022-06-02 10:09 -0700
                                      Re: Wikipedia David Brown <david.brown@hesbynett.no> - 2022-06-02 22:35 +0200
                                        Re: Wikipedia Juha Nieminen <nospam@thanks.invalid> - 2022-06-03 04:22 +0000
                                          Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-03 06:23 +0200
                                            Re: Wikipedia Juha Nieminen <nospam@thanks.invalid> - 2022-06-03 04:28 +0000
                                              Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-03 06:35 +0200
                                                Re: Wikipedia Juha Nieminen <nospam@thanks.invalid> - 2022-06-03 05:22 +0000
                                                  Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-03 07:23 +0200
                                                    Re: Wikipedia "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-06-02 22:25 -0700
                                                      Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-03 07:28 +0200
                                                        Re: Wikipedia "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-06-02 22:31 -0700
                                                          Re: Wikipedia Juha Nieminen <nospam@thanks.invalid> - 2022-06-03 06:22 +0000
                                                            Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-03 08:38 +0200
                                                              Re: Wikipedia Juha Nieminen <nospam@thanks.invalid> - 2022-06-03 10:14 +0000
                                                      Re: Wikipedia "daniel...@gmail.com" <danielaparker@gmail.com> - 2022-06-03 06:32 -0700
                                                        Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-03 15:35 +0200
                                                        Re: Wikipedia "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-06-03 14:12 -0700
                                          Re: Wikipedia David Brown <david.brown@hesbynett.no> - 2022-06-03 10:31 +0200
                                Re: Wikipedia Manfred <noname@add.invalid> - 2022-06-02 19:12 +0200
                                Re: Wikipedia Popping Mad <rainbow@colition.gov> - 2022-06-04 13:09 -0400
                            Re: Wikipedia Manu Raju <MR@invalid.invalid> - 2022-06-02 17:54 +0100
                              Re: Wikipedia Paavo Helde <eesnimi@osa.pri.ee> - 2022-06-02 20:40 +0300
                                Re: Wikipedia Manu Raju <MR@invalid.invalid> - 2022-06-02 18:50 +0100
                              Re: Wikipedia Juha Nieminen <nospam@thanks.invalid> - 2022-06-03 04:25 +0000
                        Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-01 14:21 +0200
                        Re: Wikipedia "daniel...@gmail.com" <danielaparker@gmail.com> - 2022-06-01 06:17 -0700
                          Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-01 15:34 +0200
                            Re: Wikipedia "daniel...@gmail.com" <danielaparker@gmail.com> - 2022-06-01 07:13 -0700
                              Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-01 16:55 +0200
                      Re: Wikipedia David Brown <david.brown@hesbynett.no> - 2022-06-01 16:29 +0200
                        Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-01 16:56 +0200
                        Re: Wikipedia "daniel...@gmail.com" <danielaparker@gmail.com> - 2022-06-01 07:58 -0700
                          Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-01 17:07 +0200
                            Re: Wikipedia David Brown <david.brown@hesbynett.no> - 2022-06-01 17:50 +0200
                              Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-01 18:11 +0200
                          Re: Wikipedia David Brown <david.brown@hesbynett.no> - 2022-06-01 17:41 +0200
                          Re: Wikipedia Manfred <noname@add.invalid> - 2022-06-01 17:42 +0200
                            Re: Wikipedia "daniel...@gmail.com" <danielaparker@gmail.com> - 2022-06-01 09:12 -0700
                              Re: Wikipedia Manfred <noname@add.invalid> - 2022-06-01 18:35 +0200
                                Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-01 18:36 +0200
                                  Re: Wikipedia Manfred <noname@add.invalid> - 2022-06-01 18:59 +0200
                                    Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-01 19:04 +0200
                                Re: Wikipedia "daniel...@gmail.com" <danielaparker@gmail.com> - 2022-06-01 10:04 -0700
                                Re: Wikipedia Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-06-07 08:28 -0700
                              Re: Wikipedia David Brown <david.brown@hesbynett.no> - 2022-06-01 21:22 +0200
                                Re: Wikipedia "daniel...@gmail.com" <danielaparker@gmail.com> - 2022-06-01 13:43 -0700
                                  Re: Wikipedia David Brown <david.brown@hesbynett.no> - 2022-06-02 10:07 +0200
                            Re: Wikipedia Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-06-07 08:21 -0700
                              Re: Wikipedia "daniel...@gmail.com" <danielaparker@gmail.com> - 2022-06-10 07:18 -0700
                Re: Wikipedia muttley@dastardlyhq.com - 2022-05-31 18:34 +0000
                  Re: Wikipedia Mr Flibble <flibble@reddwarf.jmc.corp> - 2022-05-31 19:37 +0100
                    Re: Wikipedia muttley@dastardlyhq.com - 2022-05-31 18:42 +0000
                      Re: Wikipedia Mr Flibble <flibble@reddwarf.jmc.corp> - 2022-05-31 20:00 +0100
                        Re: Wikipedia muttley@dastardlyhq.com - 2022-05-31 19:19 +0000
                          Re: Wikipedia Mr Flibble <flibble@reddwarf.jmc.corp> - 2022-05-31 20:28 +0100
                            Re: Wikipedia muttley@dastardlyhq.com - 2022-06-01 18:07 +0000
                              Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-01 20:28 +0200
                          Re: Wikipedia scott@slp53.sl.home (Scott Lurndal) - 2022-05-31 19:37 +0000
                            Re: Wikipedia Vir Campestris <vir.campestris@invalid.invalid> - 2022-05-31 21:27 +0100
                          Re: "std::" (was: Wikipedia) Mr Flibble <flibble@reddwarf.jmc.corp> - 2022-05-31 21:17 +0100
                            Re: "std::" (was: Wikipedia) Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-01 06:33 +0200
                          Re: Wikipedia David Brown <david.brown@hesbynett.no> - 2022-06-01 09:34 +0200
                    Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-01 05:40 +0200
        Re: Wikipedia Manu Raju <MR@invalid.invalid> - 2022-05-31 17:18 +0100
          Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-05-31 18:25 +0200
            Re: Wikipedia David Brown <david.brown@hesbynett.no> - 2022-06-01 09:38 +0200
              Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-01 09:46 +0200
                Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-01 10:16 +0200
                  Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-01 10:21 +0200
                  Re: Wikipedia David Brown <david.brown@hesbynett.no> - 2022-06-01 17:13 +0200
                    Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-01 17:15 +0200
                      Re: Wikipedia David Brown <david.brown@hesbynett.no> - 2022-06-01 18:12 +0200
                        Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-01 18:18 +0200
                          Re: Wikipedia Bonita Montero <Bonita.Montero@gmail.com> - 2022-06-01 18:39 +0200

Page 6 of 8 — ← Prev page 1 2 3 4 5 [6] 7 8  Next page →


#84501

FromDavid Brown <david.brown@hesbynett.no>
Date2022-06-03 10:31 +0200
Message-ID<t7cgtf$vvp$1@dont-email.me>
In reply to#84487
On 03/06/2022 06:22, Juha Nieminen wrote:
> David Brown <david.brown@hesbynett.no> wrote:
>> When I have implemented my own cos and sin functions (typically for
>> higher speed, lower accuracy versions in embedded systems), I would have
>> liked to call them "cos" and "sin".  I usually go for "cosine" and
>> "sine" - in most cases the code in question has been in C or at least C
>> compatible, ruling out namespaces.
> 
> In such a case it might actually be a good idea to use a different name
> for such functions, to more clearly indicate their nature, eg. in this case
> that they may be less accurate. Perhaps something like fastsin(), fastcos(),
> etc.
> 

Sometimes that would be the best choice - sometimes not.  There are many 
possibilities.

One would be to have code such as :

double foo(double x) {
	// using std::sin, std::cos;
	using my_fast_maths_lib::sin, my_fast_maths_lib::cos;

	return cos(x) + sin(x);
}

Or to have :

// namespace maths_lib = std;
namespace maths_lib = my_fast_maths_lib;

double foo(double x) {
	using maths_lib::sin, maths_lib::cos;

	return cos(x) + sin(x);
}


This kind of thing makes it easy to be flexible and change the 
implementation used without changing the source code.  An unfortunate 
thing about having functions like cos and sin in the global identifier 
space in <cmath> is you need explicit "using" for each function, rather 
than just "using namespace std;" inside the function.
	

> (I don't think math expressions in code need to look *exactly* like on paper.
> Which they already don't; after all, people rarely use the asterisk to
> indicate multiplication when writing math on paper.)

Agreed.  It is /possible/ to write C++ so that "A = π r ²" does what you 
want, but I don't think it's a good idea!  (And you can't avoid the spaces.)

[toc] | [prev] | [next] | [standalone]


#84479

FromManfred <noname@add.invalid>
Date2022-06-02 19:12 +0200
Message-ID<t7ar23$1fph$1@gioia.aioe.org>
In reply to#84462
On 6/2/2022 10:53 AM, Juha Nieminen wrote:
> Bonita Montero <Bonita.Montero@gmail.com> wrote:
>>> Do you know every single name in the standard library? From a random list
>>> of names could you point out with accuracy which ones are used in the
>>> standard library and which ones aren't? How many programmers do you think
>>> would be able to do that?
>>
>> No, but my compiler does and gives me an error if there are any name
>> clashes. And in rare cases where I can't disambiguate a symbol which
>> could be part of multiple namespaces I right-click the symbol and
>> click "Go to definition" or "Go to declaration" and that is it.
>> So where's the problem ?
> 
> Code should be readable and easy to understand even without using some IDE.
> If the understandability of your code relies on the reader using an IDE,
> it's not well-designed code.
> 

Visual Basic enthusiasts are used to live within one IDE :)

> If it's not clear from a name in the code that it's something from the
> standard library, that only helps making the code harder to read and
> understand.
> 

[toc] | [prev] | [next] | [standalone]


#84537

FromPopping Mad <rainbow@colition.gov>
Date2022-06-04 13:09 -0400
Message-ID<t7g3l2$2ic$3@reader1.panix.com>
In reply to#84462
On 6/2/22 04:53, Juha Nieminen wrote:
> Code should be readable and easy to understand even without using some IDE.
> If the understandability of your code relies on the reader using an IDE,
> it's not well-designed code.


He didn't say IDE - he said compiler.

It is ture, as well.  gcc will throw a warning.

[toc] | [prev] | [next] | [standalone]


#84477

FromManu Raju <MR@invalid.invalid>
Date2022-06-02 17:54 +0100
Message-ID<t7aq4e$fdu$1@dont-email.me>
In reply to#84457
On 02/06/2022 05:57, Juha Nieminen wrote:
> Do you know every single name in the standard library? From a random list
> of names could you point out with accuracy which ones are used in the
> standard library and which ones aren't? How many programmers do you think
> would be able to do that?

There is no need to remember that because a good IDE will give you hints 
when you start typing. In Visual Studio I get 100s (if not 1000s) when I 
start typing "std::". See this picture:

https://i.imgur.com/CV9FJRT.png

You can scroll the list with the scroll bar as shown in the picture. 
Brain is supposed to do the thinking; not remember things because that 
is the function of writing!!

[toc] | [prev] | [next] | [standalone]


#84480

FromPaavo Helde <eesnimi@osa.pri.ee>
Date2022-06-02 20:40 +0300
Message-ID<t7aslk$473$1@dont-email.me>
In reply to#84477
02.06.2022 19:54 Manu Raju kirjutas:
> 
> There is no need to remember that because a good IDE will give you hints
> when you start typing. In Visual Studio I get 100s (if not 1000s) when I
> start typing "std::". See this picture:

So, you are saying I need to type std:: in order to not have to type std:: ?

> 
> https://i.imgur.com/CV9FJRT.png
> 
> You can scroll the list with the scroll bar as shown in the picture.
> Brain is supposed to do the thinking; not remember things because that
> is the function of writing!!

This list is populated only by the headers you have included, and does 
not show names from other standard headers. If there are no includes, 
the list only shows std::align_val_t and std::nullptr_t. Not so useful.

On top of that, the list does not show names which will be added to the 
C++ standard in the future.

It's all not about writing the initial code, but about maintaining the 
code for many years. If all your code is throw-away you don't understand 
the issues.

[toc] | [prev] | [next] | [standalone]


#84481

FromManu Raju <MR@invalid.invalid>
Date2022-06-02 18:50 +0100
Message-ID<t7atb9$a53$1@dont-email.me>
In reply to#84480
On 02/06/2022 18:40, Paavo Helde wrote:
>
> So, you are saying I need to type std:: in order to not have to type 
> std:: ?
>

I am simply saying that brain should be reserved to do the thinking and 
your notes should be used to remember things!

You only need to type std:: if you want quick reference to something 
that you want quick reminding rather than referring to your copious 
notes which you must be keeping in some form!.


[toc] | [prev] | [next] | [standalone]


#84489

FromJuha Nieminen <nospam@thanks.invalid>
Date2022-06-03 04:25 +0000
Message-ID<t7c2g3$1fft$2@gioia.aioe.org>
In reply to#84477
Manu Raju <MR@invalid.invalid> wrote:
> On 02/06/2022 05:57, Juha Nieminen wrote:
>> Do you know every single name in the standard library? From a random list
>> of names could you point out with accuracy which ones are used in the
>> standard library and which ones aren't? How many programmers do you think
>> would be able to do that?
> 
> There is no need to remember that because a good IDE will give you hints 
> when you start typing. In Visual Studio I get 100s (if not 1000s) when I 
> start typing "std::".

I was talking about reading code, not writing it. When you encounter
"std::" in code you know immediately that it's a name from the standard
library. You don't have to have memorized every single name in it to
know that.

If code readability relies on having an IDE, it's not well written code.

> Brain is supposed to do the thinking; not remember things because that 
> is the function of writing!!

Precisely my point.

[toc] | [prev] | [next] | [standalone]


#84418

FromBonita Montero <Bonita.Montero@gmail.com>
Date2022-06-01 14:21 +0200
Message-ID<t77ljr$7v3$1@dont-email.me>
In reply to#84415
I've got my personal taste and I've got the right that when I
publish my source in the Wikipedia I publish source there that's
up to my taste. My style is absolutely not rare and there are no
problems with that in the source I published as there are no con-
flicting names.
You're simply a radical and intolerant person who anticipates
catastophes when other copy my style. But that catastrophes
will never happen and its the peoples's right to program in
a way they feel most comfortable with.

[toc] | [prev] | [next] | [standalone]


#84424

From"daniel...@gmail.com" <danielaparker@gmail.com>
Date2022-06-01 06:17 -0700
Message-ID<f7b5f814-6c17-4d26-bf05-e82947d8f94fn@googlegroups.com>
In reply to#84415
On Wednesday, June 1, 2022 at 4:47:14 AM UTC-4, Öö Tiib wrote:

> You are misrepresenting the C++ Core Guidelines. You quote that: 
> <https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#sf6-use-using-namespace-directives-for-transition-for-foundation-libraries-such-as-std-or-within-a-local-scope-only> 
> It starts with "should be used sparingly" because of the very same 
> "pseudo-reason". 
> 
> | Reason: using namespace can lead to name clashes, so it should be used 
> | sparingly. 
> 

My reading of the Core Guidelines is that Stroustrup and Sutter are fine with 

using namespace std;

in cpp files. They have that in their "good" examples.  They do enjoin against 
putting "using namespace" at global scope in a header file. But they consider 
cpp files as a form of local scope. And they think that "sometimes a namespace
is so fundamental and prevalent in a code base, that consistent qualification 
would be verbose and distracting."  

> These are your own mental problems that make you to misread it as 

For consistency, and noting the above, you should also rail against
Stroustrup and Sutter's mental problems for suggesting the practice.
Otherwise people might think you are misogynist, or stupid :-)

Best regards,
Daniel

[toc] | [prev] | [next] | [standalone]


#84425

FromBonita Montero <Bonita.Montero@gmail.com>
Date2022-06-01 15:34 +0200
Message-ID<t77prt$uam$1@dont-email.me>
In reply to#84424
Am 01.06.2022 um 15:17 schrieb daniel...@gmail.com:
> On Wednesday, June 1, 2022 at 4:47:14 AM UTC-4, Öö Tiib wrote:
> 
>> You are misrepresenting the C++ Core Guidelines. You quote that:
>> <https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#sf6-use-using-namespace-directives-for-transition-for-foundation-libraries-such-as-std-or-within-a-local-scope-only>
>> It starts with "should be used sparingly" because of the very same
>> "pseudo-reason".
>>
>> | Reason: using namespace can lead to name clashes, so it should be used
>> | sparingly.
>>
> 
> My reading of the Core Guidelines is that Stroustrup and Sutter are fine with
> 
> using namespace std;
> 
> in cpp files. They have that in their "good" examples.  They do enjoin against
> putting "using namespace" at global scope in a header file. But they consider
> cpp files as a form of local scope. And they think that "sometimes a namespace
> is so fundamental and prevalent in a code base, that consistent qualification
> would be verbose and distracting."
> 
>> These are your own mental problems that make you to misread it as
> 
> For consistency, and noting the above, you should also rail against
> Stroustrup and Sutter's mental problems for suggesting the practice.
> Otherwise people might think you are misogynist, or stupid :-)

There are actually no problems arising from that I've used using
namespace std in the published sourcecode. And I don't feel uncertain
like you and others with doing that and I don't anticipate any catas-
trophes if others would copy that; I'm not the one to justice others'
styles. And its my good right to publish source code in a style I
feel most comfortable with.
So where's the problem ?

[toc] | [prev] | [next] | [standalone]


#84426

From"daniel...@gmail.com" <danielaparker@gmail.com>
Date2022-06-01 07:13 -0700
Message-ID<75d46123-0cfb-4fb7-bad0-24c2a08ba4d8n@googlegroups.com>
In reply to#84425
On Wednesday, June 1, 2022 at 9:34:06 AM UTC-4, Bonita Montero wrote:

> There are actually no problems arising from that I've used using 
> namespace std in the published sourcecode. And I don't feel uncertain 
> like you and others with doing that and I don't anticipate any catas- 
> trophes if others would copy that; I'm not the one to justice others' 
> styles. And its my good right to publish source code in a style I 
> feel most comfortable with. 
> So where's the problem ?

With your Wikipedia entry? I wasn't commenting on that, I was
commenting on Öö Tiib's post. But as far as your use of using 
namespace std goes, in the entry, that clearly has the blessing of 
Stroustrup and Sutter in the Core Guidelines. People may disagree,
of course, but then they're also disagreeing with Stroustrup and Sutter.

I don't think anyone has "rights" on Wikipedia, it's free range. But it
might at least be considered impolite for people here to change your
style like that. I think it is. 

Best regards,
Daniel

[toc] | [prev] | [next] | [standalone]


#84428

FromBonita Montero <Bonita.Montero@gmail.com>
Date2022-06-01 16:55 +0200
Message-ID<t77ul1$1oe$1@dont-email.me>
In reply to#84426
Am 01.06.2022 um 16:13 schrieb daniel...@gmail.com:
> On Wednesday, June 1, 2022 at 9:34:06 AM UTC-4, Bonita Montero wrote:
> 
>> There are actually no problems arising from that I've used using
>> namespace std in the published sourcecode. And I don't feel uncertain
>> like you and others with doing that and I don't anticipate any catas-
>> trophes if others would copy that; I'm not the one to justice others'
>> styles. And its my good right to publish source code in a style I
>> feel most comfortable with.
>> So where's the problem ?
> 
> With your Wikipedia entry? I wasn't commenting on that, I was
> commenting on Öö Tiib's post. ...

I noted that, but I also noted that you argue similary idiotic.

[toc] | [prev] | [next] | [standalone]


#84427

FromDavid Brown <david.brown@hesbynett.no>
Date2022-06-01 16:29 +0200
Message-ID<t77t3e$33m$1@dont-email.me>
In reply to#84411
On 01/06/2022 09:44, Bonita Montero wrote:
>> The whole point of having standard library names in the "std::" 
>> namespace is that new versions of C++ can have more functions, classes 
>> and other identifiers added to /their/ namespace without conflicting 
>> with user code.
>  > ...
> 
> You are also arguing with pseudo-reasons for the mental problems I
> told.

Please don't use made up words to try to justify dismissing arguments 
without thought.  And please don't use silly claims of "mental 
problems".  (Yes, I know others have stopped to that level too - that 
does not mean it is helpful or appropriate for you to do so also.)

> The C++ Core Guidelines encourage to use "using namespace std".
> That's the whole story.

No, it is not the "whole story".  The post I wrote, and that you snipped 
(perhaps without reading) is a big part of the story.

And no, the C++ Core Guidelines do /not/ encourage the use of "using 
namespace std;".  Please re-read the Guidelines section "SF.6" and try 
to understand it better.  Perhaps ask here if you need more of an 
explanation.  Amongst other things, it says:

"The use of using namespace std; leaves the programmer open to a name 
clash with a name from the standard library"

and

"However, this is not particularly likely to lead to a resolution that 
is not an error and people who use using namespace std are supposed to 
know about std and about this risk."



You /should/ know about this risk, but your thoughtless dismissal of it 
suggests you don't really understand the consequences.  When in doubt, 
do not use "using namespace std;" at file scope.

[toc] | [prev] | [next] | [standalone]


#84429

FromBonita Montero <Bonita.Montero@gmail.com>
Date2022-06-01 16:56 +0200
Message-ID<t77un9$1oe$2@dont-email.me>
In reply to#84427
> Please don't use made up words to try to justify dismissing arguments 
> without thought.  And please don't use silly claims of "mental 
> problems". ...

That's all a matter of taste and if someone wants to dictate his
taste that's clearly a mental problem which for sure goes beyond
that.

[toc] | [prev] | [next] | [standalone]


#84430

From"daniel...@gmail.com" <danielaparker@gmail.com>
Date2022-06-01 07:58 -0700
Message-ID<ae3e0864-f7fb-497d-b3a9-225ed3f264a1n@googlegroups.com>
In reply to#84427
On Wednesday, June 1, 2022 at 10:29:18 AM UTC-4, David Brown wrote:

> And please don't use silly claims of "mental  problems".

Agreed

> (Yes, I know others have stopped to that level too - that 
> does not mean it is helpful or appropriate for you to do so also.)

It's almost a trademark of this forum, regrettably.

> And no, the C++ Core Guidelines do /not/ encourage the use of "using 
> namespace std;". 

They certainly give it their blessing, from the Guidelines

Example, good
#include <iostream>
#include <string>
using namespace std;

void use()
{
    // snipped
}

> When in doubt,  do not use "using namespace std;" at file scope.

Actually, the C++ Core Guidelines specifically state that a ".cpp file 
is a form of local scope",  and they appear to have no issue with
 "using namespace std;" in this context. They mention that
"sometimes a namespace is so fundamental and prevalent in a code base, 
that consistent qualification would be verbose and distracting", and
they're clearly referring to "std". They bring up the risk of name clashes, 
but suggest it is a manageable risk.

You can of course disagree with that judgement, but then you're
also disagreeing with Stroustrup and Sutter, not just Bonita.

Best regards,
Daniel

[toc] | [prev] | [next] | [standalone]


#84433

FromBonita Montero <Bonita.Montero@gmail.com>
Date2022-06-01 17:07 +0200
Message-ID<t77vc3$fqt$2@dont-email.me>
In reply to#84430
Am 01.06.2022 um 16:58 schrieb daniel...@gmail.com:
> On Wednesday, June 1, 2022 at 10:29:18 AM UTC-4, David Brown wrote:
> 
>> And please don't use silly claims of "mental  problems".
> 
> Agreed
> 
>> (Yes, I know others have stopped to that level too - that
>> does not mean it is helpful or appropriate for you to do so also.)
> 
> It's almost a trademark of this forum, regrettably.
> 
>> And no, the C++ Core Guidelines do /not/ encourage the use of "using
>> namespace std;".
> 
> They certainly give it their blessing, from the Guidelines
> 
> Example, good
> #include <iostream>
> #include <string>
> using namespace std;
> 
> void use()
> {
>      // snipped
> }
> 
>> When in doubt,  do not use "using namespace std;" at file scope.
> 
> Actually, the C++ Core Guidelines specifically state that a ".cpp file
> is a form of local scope",  and they appear to have no issue with
>   "using namespace std;" 

Thanks.
I think Stroustrup would never be a so succesful person if he would
have opinions like that we see here. He would feel uncomfortable all
the day.

[toc] | [prev] | [next] | [standalone]


#84438

FromDavid Brown <david.brown@hesbynett.no>
Date2022-06-01 17:50 +0200
Message-ID<t781rd$5ko$1@dont-email.me>
In reply to#84433
On 01/06/2022 17:07, Bonita Montero wrote:
> Am 01.06.2022 um 16:58 schrieb daniel...@gmail.com:
>> On Wednesday, June 1, 2022 at 10:29:18 AM UTC-4, David Brown wrote:
>>
>>> And please don't use silly claims of "mental  problems".
>>
>> Agreed
>>
>>> (Yes, I know others have stopped to that level too - that
>>> does not mean it is helpful or appropriate for you to do so also.)
>>
>> It's almost a trademark of this forum, regrettably.
>>
>>> And no, the C++ Core Guidelines do /not/ encourage the use of "using
>>> namespace std;".
>>
>> They certainly give it their blessing, from the Guidelines
>>
>> Example, good
>> #include <iostream>
>> #include <string>
>> using namespace std;
>>
>> void use()
>> {
>>      // snipped
>> }
>>
>>> When in doubt,  do not use "using namespace std;" at file scope.
>>
>> Actually, the C++ Core Guidelines specifically state that a ".cpp file
>> is a form of local scope",  and they appear to have no issue with
>>   "using namespace std;" 
> 
> Thanks.
> I think Stroustrup would never be a so succesful person if he would
> have opinions like that we see here. He would feel uncomfortable all
> the day.

 From the little I know of him as a person, I agree with that - but with 
one proviso.  /You/ would be one of the posters that make him most 
uncomfortable.  Your claims that the guidelines recommend general use of 
file-scope "using namespace std;" are exactly the kind of unjustified 
opinion that irritate many people.  Your accusations of "mental 
problems" are equally annoying.  (You are not alone in these, of course 
- such attitudes turn up in many online discussion forums.)

You were on a far better standing when you wrote that it was /your/ 
choice for code /you/ wrote.

Similarly, people who disagree with having it in code on Wikipedia would 
be better off saying they disapprove of it in those circumstances, than 
making absolute demands that it should never be used.

[toc] | [prev] | [next] | [standalone]


#84441

FromBonita Montero <Bonita.Montero@gmail.com>
Date2022-06-01 18:11 +0200
Message-ID<t78328$s1s$2@dont-email.me>
In reply to#84438
>  From the little I know of him as a person, I agree with that - but with 
> one proviso.  /You/ would be one of the posters that make him most 
> uncomfortable. ...

I'm sure that he isn't that kind of idiot.
Rest unread.

[toc] | [prev] | [next] | [standalone]


#84436

FromDavid Brown <david.brown@hesbynett.no>
Date2022-06-01 17:41 +0200
Message-ID<t781b5$qbq$1@dont-email.me>
In reply to#84430
On 01/06/2022 16:58, daniel...@gmail.com wrote:
> On Wednesday, June 1, 2022 at 10:29:18 AM UTC-4, David Brown wrote:
> 
>> And please don't use silly claims of "mental  problems".
> 
> Agreed
> 
>> (Yes, I know others have stopped to that level too - that
>> does not mean it is helpful or appropriate for you to do so also.)
> 
> It's almost a trademark of this forum, regrettably.
> 
>> And no, the C++ Core Guidelines do /not/ encourage the use of "using
>> namespace std;".
> 
> They certainly give it their blessing, from the Guidelines
> 
> Example, good
> #include <iostream>
> #include <string>
> using namespace std;
> 
> void use()
> {
>      // snipped
> }
> 
>> When in doubt,  do not use "using namespace std;" at file scope.
> 
> Actually, the C++ Core Guidelines specifically state that a ".cpp file
> is a form of local scope",  and they appear to have no issue with
>   "using namespace std;" in this context. They mention that
> "sometimes a namespace is so fundamental and prevalent in a code base,
> that consistent qualification would be verbose and distracting", and
> they're clearly referring to "std". They bring up the risk of name clashes,
> but suggest it is a manageable risk.
> 

They do indeed - and so they find it useful for short examples for 
demonstration purposes, and imply that it will be suitable for /some/ 
real-world code (such as cpp files that are very short).

The guidelines are just that - guidelines.  They are not absolute rules, 
and there may be circumstances in which file-scope "using namespace 
std;" is the "best" solution, precisely because "best" is so dependent 
on the situation.

> You can of course disagree with that judgement, but then you're
> also disagreeing with Stroustrup and Sutter, not just Bonita.
> 

I've read nothing to suggest that either Stroustrup or Sutter recommend 
file-scope "using namespace std;" in general coding, or anywhere other 
than in a few use-cases such as short example code.  They don't rule 
against it - clearly it is a feature supported by the language, and 
people can use the features they find best for their purposes.

[toc] | [prev] | [next] | [standalone]


#84437

FromManfred <noname@add.invalid>
Date2022-06-01 17:42 +0200
Message-ID<t781e0$nbh$1@gioia.aioe.org>
In reply to#84430
On 6/1/2022 4:58 PM, daniel...@gmail.com wrote:
> On Wednesday, June 1, 2022 at 10:29:18 AM UTC-4, David Brown wrote:
> 
>> And please don't use silly claims of "mental  problems".
> 
> Agreed
> 
>> (Yes, I know others have stopped to that level too - that
>> does not mean it is helpful or appropriate for you to do so also.)
> 
> It's almost a trademark of this forum, regrettably.
> 
>> And no, the C++ Core Guidelines do /not/ encourage the use of "using
>> namespace std;".
> 
> They certainly give it their blessing, from the Guidelines

Put this way, I find it hard to believe, please give exact reference of 
the example below.

> 
> Example, good
> #include <iostream>
> #include <string>
> using namespace std;
> 
> void use()
> {
>      // snipped
> }
> 
>> When in doubt,  do not use "using namespace std;" at file scope.
> 
> Actually, the C++ Core Guidelines specifically state that a ".cpp file
> is a form of local scope",  and they appear to have no issue with
>   "using namespace std;" in this context. They mention that
> "sometimes a namespace is so fundamental and prevalent in a code base,
> that consistent qualification would be verbose and distracting", and
> they're clearly referring to "std". They bring up the risk of name clashes,
> but suggest it is a manageable risk.

You should stop extrapolating your conclusions from pieces of sentences 
extrapolated from context.

SF.6 (thanks to David for giving this accurate reference) clearly states 
its intent from the very beginning, i.e. its title:

"SF.6: Use using namespace directives for transition, for foundation 
libraries (such as std), or within a local scope (only)"

Now, instead of giving their blessing to the use of "using namespace 
std;" (actually, using directives in general, not only std), the authors 
clearly give /constraints/ on where it is allowed to use this construct: 
note the (only) part in that title.
This is very different from what you say.

In particular, they give a motivation for this directive for the 
following reasons:

1) "transition". This means help dealing with legacy code, not at all an 
endorsement to use it with new code.

2) "foundation libraries (such as std)". This is probably the more 
important part: it means that *if* you are writing a standard library 
implementation, then you'd better have "using namespace std;" in your 
.cpp files, since most if not all of what you are writing lives within 
the std namespace(!)

3) "local scope". This is the handle you are trying to hold so tight on 
to. In fact, it means that in a limited and controlled scope, you may 
use a using directive. This still is in the perspective of containing 
namespaces to avoid clashes, but instead of controlling the imported 
namespace (std), you make the choice of controlling your own namespace, 
by keeping it small.
Again, this is very different from a generic "blessing" to using 
namespace std; everywhere.

About the note "A .cpp file is a form of local scope": here too you 
should read beyond the first dozen of letters. If you read the note in 
full, you'd see that it is in fact about how large is the scope in which 
you are injecting the std namespace: it explains that it is the N-line 
count that matters, whether it be a single function or a combined set of 
multiple functions "with N lines of code in total". It does not 
contradict, but instead it clearly applies to, the choice of having your 
own namespace small.

Back to the OP, the code that Bonita posted on Wikipedia is clearly 
larger than a handful of lines, and anyway it may be meant to be 
integrated in a larger program. "using namespace std;" is still a poor 
choice, even in the light of the C++ core guidelines.

> 
> You can of course disagree with that judgement, but then you're
> also disagreeing with Stroustrup and Sutter, not just Bonita.

No, we are not disagreeing with Stroustrup and Sutter. On the other 
hand, it appears that it is you and Bonita who do not understand 
properly what they wrote.

> 
> Best regards,
> Daniel

[toc] | [prev] | [next] | [standalone]


Page 6 of 8 — ← Prev page 1 2 3 4 5 [6] 7 8  Next page →

Back to top | Article view | comp.lang.c++


csiph-web