Monday, November 28, 2022

Digest for comp.lang.c++@googlegroups.com - 18 updates in 6 topics

Muttley@dastardlyhq.com: Nov 28 11:31AM

On Sat, 26 Nov 2022 13:33:46 -0600
>for the users to specify their simulation. The main window looks a lot
>like Visio.
> https://www.winsim.com/screenshots.html
 
Looks like it was designed in the 90s. I still fail to see how even with
what you've mentioned it can possibly require 450K lines of C++.
 
>Writing commercial software requires a lot of code.
 
Not that much for just the interface alone. One commercial windows package
I worked on which was heavily mathematical and had complex graphics in numerous
sub windows was "only" 100K lines.
Lynn McGuire <lynnmcguire5@gmail.com>: Nov 28 01:36PM -0600

On 11/27/2022 10:44 AM, Gary Scott wrote:
> development/support team, but I've had numerous examples of overnight
> updates over the years.
 
>>> Lynn
 
We abandoned our Gino front end on Vax VMS in 1993 and moved totally to
Windows. We could not support both.
 
Lynn
Gary Scott <garylscott@sbcglobal.net>: Nov 28 05:00PM -0600

On 11/28/2022 1:36 PM, Lynn McGuire wrote:
 
>>>> Lynn
 
> We abandoned our Gino front end on Vax VMS in 1993 and moved totally to
> Windows.  We could not support both.
 
GINO has been primarily a windows product since the 80s. Other OS are a
subset in terms of GUI support.
 
Gary Scott <garylscott@sbcglobal.net>: Nov 28 05:02PM -0600

On 11/28/2022 5:00 PM, Gary Scott wrote:
>> to Windows.  We could not support both.
 
> GINO has been primarily a windows product since the 80s.  Other OS are a
> subset in terms of GUI support.
 
er...90s.
 
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Nov 27 03:46PM -0800

On 11/27/2022 3:19 AM, Mr Flibble wrote:
> Hi!
 
> Use struct instead of class if you don't have a class invariant.
 
Have you ever used a class and made everything private, then slowly made
aspects of it public on an as needed basis?
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Nov 27 03:52PM -0800

On 11/27/2022 3:19 AM, Mr Flibble wrote:
> Hi!
 
> Use struct instead of class if you don't have a class invariant.
 
probably want to use a struct for a POD as well.
Bonita Montero <Bonita.Montero@gmail.com>: Nov 28 09:42AM +0100

Am 27.11.2022 um 12:19 schrieb Mr Flibble:
 
> Hi!
> Use struct instead of class if you don't have a class invariant.
 
I use both interchangeable and I use a struct when the first
member is public, a class when the first member is private.
Paul N <gw7rib@aol.com>: Nov 28 05:27AM -0800

On Sunday, November 27, 2022 at 11:19:47 AM UTC, Mr Flibble wrote:
> Use struct instead of class if you don't have a class invariant.
 
How about an example? If an object is a spreadsheet cell, having among other things a (potential) formula and a resulting value, does it have a class invariant? Would it be best as a struct or a class?
JiiPee <kerrttuPoistaTama11@gmail.com>: Nov 28 06:07PM +0200

On 28/11/2022 01:46, Chris M. Thomasson wrote:
 
>> Use struct instead of class if you don't have a class invariant.
 
> Have you ever used a class and made everything private, then slowly made
> aspects of it public on an as needed basis?
 
ye by default private
Muttley@dastardlyhq.com: Nov 28 04:11PM

On Mon, 28 Nov 2022 18:07:25 +0200
 
>> Have you ever used a class and made everything private, then slowly made
>> aspects of it public on an as needed basis?
 
>ye by default private
 
I do the opposite. Make everything public then set things private if they
absolutely must be. I don't understand why you'd take away the ability of
something to access as much of your class data as possible, its not your
house that needs to be protected against theft, its code providing a service.
Mr Flibble <flibble@reddwarf.jmc.corp>: Nov 28 06:10PM

On Mon, 28 Nov 2022 16:11:18 +0000, Muttley wrote:
 
> ability of something to access as much of your class data as possible,
> its not your house that needs to be protected against theft, its code
> providing a service.
 
You need to learn what "encapsulation" means; only have a minimum of
public methods: the more public methods a class has the less encapsulated
it is. Any member variables that form part of the class's invarient MUST
be private.
 
/Flibble
Mr Flibble <flibble@reddwarf.jmc.corp>: Nov 28 06:42PM

On Mon, 28 Nov 2022 05:27:42 -0800, Paul N wrote:
 
 
> How about an example? If an object is a spreadsheet cell, having among
> other things a (potential) formula and a resulting value, does it have a
> class invariant? Would it be best as a struct or a class?
 
If the resultant value is the result of executing the formula then you
could argue that both together form an invariant.
 
/Flibble
Vir Campestris <vir.campestris@invalid.invalid>: Nov 28 09:24PM

On 28/11/2022 18:10, Mr Flibble wrote:
> public methods: the more public methods a class has the less encapsulated
> it is. Any member variables that form part of the class's invarient MUST
> be private.
 
After the other thread I'm gobsmacked. This is exactly the point.
 
Andy
Vir Campestris <vir.campestris@invalid.invalid>: Nov 28 09:22PM

On 27/11/2022 22:36, Mr Flibble wrote:
> code that reproduces the problem. It is not always easy to pare down an
> existing codebase into a test case for a bug report especially in the case
> of internal compiler errors (ICEs).
 
After a career of over 40 years as a professional software engineer -
yes, I have some idea of what a test case is. I think you haven't been
doing this quite so long.
 
And there are tools which will automate the process. Such as
 
<https://embed.cs.utah.edu/creduce/>
 
> Also, as with Bonita, I couldn't give one iota of a fuck as to whether you
> believe me or not.
 
Ah, perhaps something we can agree on. Except perhaps in the sign?
 
Andy
Bonita Montero <Bonita.Montero@gmail.com>: Nov 28 11:07AM +0100

The program tests the throughput of aligned memory accesses vs.
unaligned memory accesses and unaligned memory accesses crossing
a page-boundary. Aligned and unaligned memory accesses have the
same speed on current x86-CPUs if they don't cross a page-boun-
dary, the latter ones cost more than twice the CPU-time on my
AMD Zen2 CPU.
I asked myself about the cost of unaligned accesses when I had
a large lineary accessed data structure for which I used #pragma
pack(1) and when I got a measureable speed-up.
David Brown <david.brown@hesbynett.no>: Nov 28 08:56AM +0100

> string name = "Paul";
 
> why the initialization is preferred syntax for c++20, good grief.
> feels like change for change sake.
 
I have always felt more comfortable with the "old-style" assignment
initialisation for simple types - using braces looks ugly to me. But
it's a matter of personal preference and habit.
 
If you want an error for "int number = 86.9;", then with gcc at least
you can use "-Werror=conversion". I expect clang has the same flag, but
I don't know about other compilers.
 
Trying to change the C++ standard here would be a disaster for existing
code (which is why errors for narrowing conversions were possible for
the new brace initialisation syntax, but could not be changed for old
assignment initialisation). So warning flags in compilers and linters
is the best you can do.
Juha Nieminen <nospam@thanks.invalid>: Nov 28 08:09AM

> else
> {...}
 
> come on there can't be much use of this can there?
 
It's not only to limit the visibility of the variable to the scope of the
conditional (which in itself is useful, don't get me wrong). Sometimes
you want the object in question to be destroyed at the end of the
conditional. Before you had to do it in an uglier way:
 
//----------------------------------------
code_code_code();
 
{
Type obj = something;
if(obj)
{
do_something_with(obj);
}
} // 'obj' will be destroyed here
 
more_code_here();
//----------------------------------------
 
Now you can achieve the same thing easier:
 
//----------------------------------------
code_code_code();
 
if(Type obj = something; obj)
{
do_something_with(obj);
} // 'obj' will be destroyed herre
 
more_code_here();
//----------------------------------------
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Nov 27 10:13PM -0800

On 5/12/2022 12:16 PM, Chris M. Thomasson wrote:
> Using my experimental vector field to generate a fractal formation. Here
> is generation two:
 
> https://fractalforums.org/gallery/1612-120522191048.png
 
I finally got back into coding modern OpenGL from scratch using C++ and
GLSL shader language.
 
https://www.facebook.com/photo?fbid=866496074509392
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

No comments: