Thursday, December 19, 2019

Digest for comp.lang.c++@googlegroups.com - 14 updates in 3 topics

boltar@nowhere.co.uk: Dec 19 08:42AM

On Wed, 18 Dec 2019 19:56:04 +0000
 
>Ah, I misread what "boltar" said; obviously using them for function return is
>fine and calling a method to get the contained value is not an issue like
>"boltar" suggests.
 
I never said it was an issue, I said it was pointless and inefficient.
boltar@nowhere.co.uk: Dec 19 08:47AM

On Wed, 18 Dec 2019 22:12:26 +0200
>smartpointers to larger data objects, etc. It would make no sense to use
>a 10x larger class than necessary for the most heavily used data
>structure in the program.
 
I'm not seeing any kind of sane argument here. If you wish to store instances
of variable sizes that can be accessed in a common way then just use base
class pointers pointing to various levels of derived classes and use virtual
functions as appropriate. As has been done for 2 decades. All I can see is
a very poor and confusing - not to mention error prone - reinvention of the
wheel.
 
>Another technical tool which can be used for reducing such memory usage
>is derivation.
 
Exactly.
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Dec 19 08:26PM

>> fine and calling a method to get the contained value is not an issue like
>> "boltar" suggests.
 
> I never said it was an issue, I said it was pointless and inefficient.
 
"pointless" : subjective!
"inefficient: compared to what?
 
/Flibble
 
--
"Snakes didn't evolve, instead talking snakes with legs changed into snakes." - Rick C. Hodgin
 
"You won't burn in hell. But be nice anyway." – Ricky Gervais
 
"I see Atheists are fighting and killing each other again, over who doesn't believe in any God the most. Oh, no..wait.. that never happens." – Ricky Gervais
 
"Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Byrne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?"
"I'd say, bone cancer in children? What's that about?" Fry replied.
"How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil."
"Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say."
Cholo Lennon <chololennon@hotmail.com>: Dec 19 12:10AM -0300

On 12/18/19 4:04 PM, Thiago Adams wrote:
 
> And it is becoming even more complex in C++ 20.
> E.g
> https://en.cppreference.com/w/cpp/chrono/month_day
 
Here is the rational (for all of them who didn't watch it):
 
Opening Keynote Meeting C++ 2019 - Howard Hinnant - Design Rationale for
the chrono Library
https://youtu.be/adSAN282YIw?list=WL
 
Regards
 
--
Cholo Lennon
Bs.As.
ARG
Thiago Adams <thiago.adams@gmail.com>: Dec 19 04:19AM -0800

On Thursday, December 19, 2019 at 12:10:57 AM UTC-3, Cholo Lennon wrote:
 
> Opening Keynote Meeting C++ 2019 - Howard Hinnant - Design Rationale for
> the chrono Library
> https://youtu.be/adSAN282YIw?list=WL
 
I think some design decisions, like automatic conversions ms->h etc,
have a consequence and everything must be a type.
 
I prefer to think about day as just a number. The only think
we need to think about is to check the range if it starts with
0 or 1 for instance.
 
I believe 99% of the time what we need is something very basic
and conversions between different time formats.
boltar@nowhere.co.uk: Dec 19 04:31PM

On Thu, 19 Dec 2019 04:19:03 -0800 (PST)
>0 or 1 for instance.
 
>I believe 99% of the time what we need is something very basic
>and conversions between different time formats.
 
Another wheel reinvention. Perhaps they should have just incorporated the
Posix time API into C++ so Windows users could have a decent API instead of
creating an entirely new one. The only reason for this library existing is
cross platform development as per the threading library (which is still less
comprehensive than pthreads).
"Öö Tiib" <ootiib@hot.ee>: Dec 18 03:36PM -0800

On Thursday, 19 December 2019 01:15:06 UTC+2, Mr Flibble wrote:
 
> is ew and
 
> v1.z() = 42.0
 
> is even more ew.
 
I trust v1.moveBy(0.0, 0.0, 39.0) or
v1.moveTo(1.0, 2.0, 42.0) depending what was the point
is simpler to understand than v1.z = 42.0 anyway.
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Dec 18 03:38PM -0800

On 12/18/2019 1:34 PM, Mr Flibble wrote:
> and I suspect it is full of UB but I am finding it hard to care as I
> cannot see any other way of doing this.
 
> Collective thoughts/wisdom?
[...]
 
Are you trying to get close to GLSL? The glm lib for C++ is very close,
but its does not have the .xyz type of functionality. Interesting.
 
vec4 v4 = vec4(v3.xyz, 1.0);
 
v4 now equals { v3.x, v3.y, v3.z, 1.0 }
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Dec 18 11:14PM

On 18/12/2019 22:24, Öö Tiib wrote:
> vec4 v3 = v1.xyzz();
 
> Couple of extra parentheses can't be problem, otherwise we all
> would switch to Kotlin (that is *way* less verbose than C++).
 
Because
 
v1.set_z(42.0);
 
is ew and
 
v1.z() = 42.0
 
is even more ew.
 
/Flibble
 
--
"Snakes didn't evolve, instead talking snakes with legs changed into snakes." - Rick C. Hodgin
 
"You won't burn in hell. But be nice anyway." – Ricky Gervais
 
"I see Atheists are fighting and killing each other again, over who doesn't believe in any God the most. Oh, no..wait.. that never happens." – Ricky Gervais
 
"Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Byrne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?"
"I'd say, bone cancer in children? What's that about?" Fry replied.
"How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil."
"Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say."
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Dec 19 06:18AM

On 18/12/2019 23:36, Öö Tiib wrote:
 
> I trust v1.moveBy(0.0, 0.0, 39.0) or
> v1.moveTo(1.0, 2.0, 42.0) depending what was the point
> is simpler to understand than v1.z = 42.0 anyway.
 
No. v1 += vec3{ 0.0, 0.0, 39.0 } is.
 
/Flibble
 
--
"Snakes didn't evolve, instead talking snakes with legs changed into snakes." - Rick C. Hodgin
 
"You won't burn in hell. But be nice anyway." – Ricky Gervais
 
"I see Atheists are fighting and killing each other again, over who doesn't believe in any God the most. Oh, no..wait.. that never happens." – Ricky Gervais
 
"Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Byrne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?"
"I'd say, bone cancer in children? What's that about?" Fry replied.
"How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil."
"Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say."
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Dec 19 06:19AM

On 18/12/2019 23:38, Chris M. Thomasson wrote:
 
> Are you trying to get close to GLSL? The glm lib for C++ is very close, but its does not have the .xyz type of functionality. Interesting.
 
> vec4 v4 = vec4(v3.xyz, 1.0);
 
> v4 now equals { v3.x, v3.y, v3.z, 1.0 }
 
That is the goal, yes.
 
/Flibble
 
--
"Snakes didn't evolve, instead talking snakes with legs changed into snakes." - Rick C. Hodgin
 
"You won't burn in hell. But be nice anyway." – Ricky Gervais
 
"I see Atheists are fighting and killing each other again, over who doesn't believe in any God the most. Oh, no..wait.. that never happens." – Ricky Gervais
 
"Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Byrne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?"
"I'd say, bone cancer in children? What's that about?" Fry replied.
"How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil."
"Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say."
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Dec 19 10:49AM +0100

On 19.12.2019 00:14, Mr Flibble wrote:
 
> is ew and
 
> v1.z() = 42.0
 
> is even more ew.
 
#define Z z()
 
There.
 
 
- Alf
Manfred <noname@add.invalid>: Dec 19 02:25PM +0100

On 12/18/2019 10:34 PM, Mr Flibble wrote:
> and I suspect it is full of UB but I am finding it hard to care as I
> cannot see any other way of doing this.
 
> Collective thoughts/wisdom?
 
Sounds like a union is not the right tool, unless I am misinterpreting
the purpose.
Possibly xy, z, xyz etc. should be object members that overload the
assignment and type cast (aka user-defined conversion) operators.
Inside the body of the overloads you perform the actions you need on the
vector (so you need a reference to the vector inside the members).
Manfred <noname@add.invalid>: Dec 19 02:29PM +0100

On 12/19/2019 12:14 AM, Mr Flibble wrote:
 
> v1.z() = 42.0
 
> is even more ew.
 
> /Flibble
 
A slightly better (IMO) interface is:
void z(double val);
double z() const;
 
That doesn't change much, though.
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: