Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #123730
| From | Jonathan Lamothe <jonathan@jlamothe.net> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: Move semantics with literals |
| Date | 2026-04-14 13:36 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <87pl414f64.fsf@posteo.de> (permalink) |
| References | <10rlkk9$6hau$1@dont-email.me> <87jyu960xp.fsf@posteo.de> <10rlldg$6qiv$1@dont-email.me> <xEuDR.194284$4wI6.33753@fx24.iad> |
scott@slp53.sl.home (Scott Lurndal) writes:
> boltar@caprica.universe writes:
>>On Tue, 14 Apr 2026 11:01:22 -0400
>>Jonathan Lamothe <jonathan@jlamothe.net> gabbled:
>>>boltar@caprica.universe writes:
>>>
>>>> To my chagrin I got caught out by this trick question in an interview:
>>>>
>>>> int func(int &&a)
>>>> {
>>>> return a * 2;
>>>> }
>>>>
>>>>
>>>> :
>>>> int b = func(123);
>>>> :
>>>>
>>>> Where the question was "what would happen". I assumed it wouldn't compile
>>>> being a reference to a literal but it does. So I'm just wondering why on
>>>> earth and when would you ever do the above? Is there some wierd use case?
>>>
>>>The only use case I can see is tricky interview questions. ;)
>>
>>Unfortunately it was that kind of interview where they tried to catch you
>>out rather than testing your code writing and debugging abilities. Luckily I
>>wasn't fooled by the other questions though it does make me wonder if I'd want
>>to work in a place that has this kind of moronic interview process.
>>
>
> I dunno, perhaps they're doing it intentionally to weed out
> candidates that did not object to the the silly test?
<snip>
That's one of the few reasons I would accept as valid. I have my doubts
however as to whether this is what they ware actually doing. In my
experience, most employers don't like it when their employees push back
on nonsense.
--
Regards,
Jonathan Lamothe
https://jlamothe.net
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Move semantics with literals boltar@caprica.universe - 2026-04-14 14:57 +0000
Re: Move semantics with literals Jonathan Lamothe <jonathan@jlamothe.net> - 2026-04-14 11:01 -0400
Re: Move semantics with literals wij <wyniijj5@gmail.com> - 2026-04-14 23:04 +0800
Re: Move semantics with literals Jonathan Lamothe <jonathan@jlamothe.net> - 2026-04-14 11:10 -0400
Re: Move semantics with literals David Brown <david.brown@hesbynett.no> - 2026-04-14 17:26 +0200
Re: Move semantics with literals Bonita Montero <Bonita.Montero@gmail.com> - 2026-04-14 18:25 +0200
Re: Move semantics with literals Jonathan Lamothe <jonathan@jlamothe.net> - 2026-04-14 13:02 -0400
Re: Move semantics with literals boltar@caprica.universe - 2026-04-15 08:18 +0000
Re: Move semantics with literals Paavo Helde <eesnimi@osa.pri.ee> - 2026-04-15 12:50 +0300
Re: Move semantics with literals Bonita Montero <Bonita.Montero@gmail.com> - 2026-04-15 14:24 +0200
Re: Move semantics with literals boltar@caprica.universe - 2026-04-15 15:07 +0000
Re: Move semantics with literals Bonita Montero <Bonita.Montero@gmail.com> - 2026-04-15 17:49 +0200
Re: Move semantics with literals Bonita Montero <Bonita.Montero@gmail.com> - 2026-04-15 17:51 +0200
Re: Move semantics with literals boltar@caprica.universe - 2026-04-16 08:29 +0000
Re: Move semantics with literals scott@slp53.sl.home (Scott Lurndal) - 2026-04-16 14:41 +0000
Re: Move semantics with literals Chris Ahlstrom <OFeem1987@teleworm.us> - 2026-04-18 06:41 -0400
Re: Move semantics with literals Richard Damon <Richard@Damon-Family.org> - 2026-04-18 12:46 -0400
Re: Move semantics with literals "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-04-15 23:08 -0700
Re: Move semantics with literals Bonita Montero <Bonita.Montero@gmail.com> - 2026-04-16 09:02 +0200
Re: Move semantics with literals "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-04-16 04:39 -0700
Re: Move semantics with literals boltar@caprica.universe - 2026-04-14 15:10 +0000
Re: Move semantics with literals Jonathan Lamothe <jonathan@jlamothe.net> - 2026-04-14 11:15 -0400
Re: Move semantics with literals scott@slp53.sl.home (Scott Lurndal) - 2026-04-14 17:17 +0000
Re: Move semantics with literals Jonathan Lamothe <jonathan@jlamothe.net> - 2026-04-14 13:36 -0400
Re: Move semantics with literals boltar@caprica.universe - 2026-04-15 08:21 +0000
Re: Move semantics with literals Andrey Tarasevich <noone@noone.net> - 2026-04-18 10:16 -0700
Re: Move semantics with literals boltar@caprica.universe - 2026-04-19 08:59 +0000
Re: Move semantics with literals boltar@caprica.universe - 2026-04-19 09:09 +0000
Re: Move semantics with literals Andrey Tarasevich <noone@noone.net> - 2026-04-19 12:01 -0700
Re: Move semantics with literals Bonita Montero <Bonita.Montero@gmail.com> - 2026-04-14 17:14 +0200
Re: Move semantics with literals boltar@caprica.universe - 2026-04-14 15:23 +0000
Re: Move semantics with literals Bonita Montero <Bonita.Montero@gmail.com> - 2026-04-14 18:23 +0200
Re: Move semantics with literals Andrey Tarasevich <noone@noone.net> - 2026-04-18 09:27 -0700
Re: Move semantics with literals Andrey Tarasevich <noone@noone.net> - 2026-04-18 09:46 -0700
csiph-web