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


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

Re: Probably UB but I am finding it hard to give a fuck (C++ swizzle)

Subject Re: Probably UB but I am finding it hard to give a fuck (C++ swizzle)
Newsgroups comp.lang.c++
References <cYwKF.3051$vj3.487@fx10.dcg> <qteda4$1vi2$1@gioia.aioe.org>
From Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>
Organization Jupiter Mining Corporation
Message-ID <9EEKF.6570$RQ.608@fx09.dcg> (permalink)
Date 2019-12-19 06:19 +0000

Show all headers | View raw


On 18/12/2019 23:38, Chris M. Thomasson wrote:
> On 12/18/2019 1:34 PM, Mr Flibble wrote:
>> Hi!
>>
>> The following is the base class of my vector class (the mathematical vector not the container) so I can do things like:
>>
>> vec3 v1 = { 1.0, 2.0, 3.0 };
>> vec2 v2 = v1.xy;
>> double z = v1.z;
>> vec4 v3 = v1.xyzz;
>>
>> So we have an anonymous union of an anonymous struct and some swizzles 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 }

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."

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


Thread

Probably UB but I am finding it hard to give a fuck (C++ swizzle) Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2019-12-18 21:34 +0000
  Re: Probably UB but I am finding it hard to give a fuck (C++ swizzle) Öö Tiib <ootiib@hot.ee> - 2019-12-18 14:24 -0800
    Re: Probably UB but I am finding it hard to give a fuck (C++ swizzle) Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2019-12-18 23:14 +0000
      Re: Probably UB but I am finding it hard to give a fuck (C++ swizzle) Öö Tiib <ootiib@hot.ee> - 2019-12-18 15:36 -0800
        Re: Probably UB but I am finding it hard to give a fuck (C++ swizzle) Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2019-12-19 06:18 +0000
      Re: Probably UB but I am finding it hard to give a fuck (C++ swizzle) "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2019-12-19 10:49 +0100
      Re: Probably UB but I am finding it hard to give a fuck (C++ swizzle) Manfred <noname@add.invalid> - 2019-12-19 14:29 +0100
  Re: Probably UB but I am finding it hard to give a fuck (C++ swizzle) "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2019-12-18 15:38 -0800
    Re: Probably UB but I am finding it hard to give a fuck (C++ swizzle) Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2019-12-19 06:19 +0000
      Re: Probably UB but I am finding it hard to give a fuck (C++ swizzle) "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2019-12-23 10:34 -0800
      Re: Probably UB but I am finding it hard to give a fuck (C++ swizzle) "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2019-12-28 00:30 -0800
        Re: Probably UB but I am finding it hard to give a fuck (C++ swizzle) Mr Flibble <flibble@i42.removethisbit.co.uk> - 2019-12-28 15:53 +0000
          Re: Probably UB but I am finding it hard to give a fuck (C++ swizzle) "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2020-01-31 23:00 -0800
  Re: Probably UB but I am finding it hard to give a fuck (C++ swizzle) Manfred <noname@add.invalid> - 2019-12-19 14:25 +0100
  Re: Probably UB but I am finding it hard to give a fuck (C++ swizzle) woodbrian77@gmail.com - 2019-12-20 08:22 -0800
    Re: Probably UB but I am finding it hard to give a fuck (C++ swizzle) Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2019-12-21 13:23 +0000
  Re: Probably UB but I am finding it hard to give a fuck (C++ swizzle) "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2020-01-11 15:08 -0800
    Re: Probably UB but I am finding it hard to give a fuck (C++ swizzle) Bonita Montero <Bonita.Montero@gmail.com> - 2020-02-10 18:35 +0100
      Re: Probably UB but I am finding it hard to give a fuck (C++ swizzle) "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2020-02-10 14:07 -0800
  Re: Probably UB but I am finding it hard to give a fuck (C++ swizzle) "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2020-01-31 21:42 -0800

csiph-web