Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

C++ and copying

Name: Anonymous 2013-06-13 5:34

Why the fuck does everything in C++ insist on endlessly copying shit here and there, spawning 4 (FOUR!!!) copies of some fucking object during certain calls to methods of stdlib containers (vector, tuple etc).

I can't create a fucking thread without it copying my ``functor'' object (with operator()) at least twice for some fucking reason.

So yeah, if you want fast C++ programs, you fucking write them in C, with manual handling of pointers and shit.  Fuck C++.

Name: Anonymous 2013-06-13 5:41

D use a different model, every heap object is once constructed trivially copyable anywhere in memory. The trade-off is that internal pointer are forbidden by the language.

If you need aggregates that own something, D has "struct" which are akin to C++ objects except for simpler move semantics.

That said, I don't find copies in C++ _that_ annoying.

Name: Anonymous 2013-06-13 5:54

In any C++ function there is a gazillion temporary copies created and destroyed every fucking nanosecond.  Guess what it does to performance if you did not bother to write an arena allocator for every fucking class of yours?  It fucking ruins it, that's what.  Wrapping every goddamn object in a shared_ptr or a unique_ptr had cut my processing time by 45% per iteration.  Fuck off C++.

Name: Anonymous 2013-06-13 5:59

>>2
But it calls both the constructor (which in C++ must not be anything non-trivial, that is, the constructor MUST be trivial) and the destructor.  If you have some cleanup logic for reference members in your destructor, good fucking luck finding which of the copies releases this or that resource.
So it's C all over again: you have the constructor, the init function, the finalize function, and the destructor.
Thanks for mentioning D, I will give it a try for some of my personal projects when I have more time, meanwhile I'm going back to destroying my brain with C++ on my day job

Name: Cudder !MhMRSATORI!fR8duoqGZdD/iE5 2013-06-13 6:17

Because the language can't make any assumptions about what your objects contain, it must use the construct/assign/destruct sequence. The standard library containers are very generic and while your case might not require the copying, it might not work in all cases. If you want a non-copying vector, you write it yourself. C++11 has some features that could help.

Name: Anonymous 2013-06-13 6:19

The implementation of the standard library specifications is not inherent in C++ itself.

Name: Anonymous 2013-06-13 9:37

>>5,6
I agree, every sane C++ programmer implements her own standard library herself.

Name: Anonymous 2013-06-13 10:11

>>7
her
herself
A sexist cunt? Want some sexy lovin'?

Name: Anonymous 2013-06-13 10:16

>>7
But there's no such thing as a sane woman.

Name: Anonymous 2013-06-13 10:18

>>5

employee Name Job Salary => | name => Name | job => Job | salary => Salary
ListOfEmployees = list employee \Cirno [ice witch] unemployed
                     | employee \Reimu [shrine maiden] self_employed
                     | employee \Cudder [gay whore] low
say employees sorted by salary are: ListOfEmployees sort by salary

Name: Anonymous 2013-06-13 11:05

>>1
I can't create a fucking thread without it copying my ``functor'' object (with operator()) at least twice for some fucking reason.
Why don't you pass your functor by reference?
How much state does your functor have -- if it doesn't have any then you probably shouldn't worry so much because copying a zero-size value-allocated object generally costs less than your mum's blowjob.

Name: Anonymous 2013-06-13 12:19

>>10
Reimu has a formal job with no reliable income source, and please don't speak ill of Cudder-氏.

Name: Anonymous 2013-06-13 12:22

>>9
Your mom is a sane woman.

Name: Anonymous 2013-06-13 12:37

KILL JEWS KILL JEWS KILL JEWS KILL JEWS KILL JEWS KILL JEWS
KILL JEWS KILL JEWS KILL JEWS KILL JEWS KILL JEWS KILL JEWS
KILL JEWS KILL JEWS KILL JEWS KILL JEWS KILL JEWS KILL JEWS
KILL JEWS KILL JEWS KILL JEWS KILL JEWS KILL JEWS KILL JEWS
KILL JEWS KILL JEWS KILL JEWS KILL JEWS KILL JEWS KILL JEWS
KILL JEWS KILL JEWS KILL JEWS KILL JEWS KILL JEWS KILL JEWS
KILL JEWS KILL JEWS KILL JEWS KILL JEWS KILL JEWS KILL JEWS
KILL JEWS KILL JEWS KILL JEWS KILL JEWS KILL JEWS KILL JEWS
KILL JEWS KILL JEWS KILL JEWS KILL JEWS KILL JEWS KILL JEWS
KILL JEWS KILL JEWS KILL JEWS KILL JEWS KILL JEWS KILL JEWS
KILL JEWS KILL JEWS KILL JEWS KILL JEWS KILL JEWS KILL JEWS
KILL JEWS KILL JEWS KILL JEWS KILL JEWS KILL JEWS KILL JEWS
KILL JEWS KILL JEWS KILL JEWS KILL JEWS KILL JEWS KILL JEWS

Name: Anonymous 2013-06-13 12:46

>>14
reported to JIDF as well as the russian government. enjoy your butthole time in prison, dipshit.

Name: Anonymous 2013-06-13 12:48

>>13
lel, I don't think so

Name: Anonymous 2013-06-13 14:33

>>16
I agree, look at how you turned out. What a shameful little pile of garbage.

Name: Anonymous 2013-06-13 18:28

const ref?

Name: Anonymous 2013-06-13 21:22

cunt breath?

Name: Anonymous 2013-06-13 22:28

JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER JEWDDER

Name: Anonymous 2013-06-14 3:52

DUBS INCOMING

Name: Anonymous 2013-06-14 4:13

nigger

Name: Anonymous 2013-06-14 5:04

>>18
Good luck storing const refs in an std::vector, nigger

Name: Anonymous 2013-06-14 5:30

>>23
http://en.cppreference.com/w/cpp/container/vector/operator_at
>reference operator[]( size_type pos );
>constexpr const_reference operator[]( size_type pos ) const;

Name: Anonymous 2013-06-14 5:31

Name: Anonymous 2013-06-14 14:10

Not using move constructors.
Not compiling with -O3 to inlinr everything

Maybe you should play with Java like a little kid you are? Leave C++ for serious men for serious business.

Name: Anonymous 2013-06-14 14:12

>>26

>le c++
>le serious business

>le imblyign

GROSKI EGIN E/G/IN GRGWEIGWIGEIWGIIGNEWGIN GROSKI LEEEEEEEEEEEEEELLLLLLLLLLLLLLLLLLL

Name: Anonymous 2013-06-14 14:31

EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS EPINS IPENS PINES PENIS IPENS SEPIN EPINS PENIS EPSIN IPENS

Name: Anonymous 2013-06-14 15:04

shiichan​=proper

Name: Anonymous 2013-06-14 16:38

From the Google C++ style guide.

<address>
Benjy Weinberger<br/>
Craig Silverstein<br/>
Gregory Eitzmann<br/>
Mark Mentovai<br/>
Tashana Landray
</address>

See any goys here?
That's C++ for you.

Name: Anonymous 2013-06-14 16:53

>>26
It's stdlib that is not using move constructors, dipshit.  C++ copies everything by default because it is a shit language, and your gay bear club of ``serious men'' is nothing but a circlejerk of uglies who love to memoize annoying details of their basic instruments.

Name: Anonymous 2013-06-14 17:31

>>30
"Tashana" appears to be Islamic name.

but yeah, Google is pretty much Jewish.

Name: Anonymous 2013-06-14 20:12

>>31
who love to memoize annoying details of their basic instruments
that means we're smarter than you broskie ;)))

Name: Anonymous 2013-06-14 20:24

>>31
copies everything by default
Because C/C++ has no garbage collector, so the only way to maintain ownership is by copying crap into a parent stack frame.

C/C++ also has long shutdown times, because of a lot of free calls in destructors and malloc managing scheme being inherently inefficient.

Name: Anonymous 2013-06-14 21:04

>>32
It also sounds like a female name. I bet she's conspiring against the sepples kikes. Good, I want to hear explosions in the Google headquarters. Girls that strap bombs to themselves make me horny, which is why I love Ichirin so fucking much.

Allahu Ackbar.
----
لَا إِلٰهَ إِلَّا الله مُحَمَّدٌ رَسُولُ الله
There is no god but God, Muhammad is the messenger of God.
[u[PUT THIS SHAHADAH IN YOUR SIGNATURE IF YOU WANT TO BOYCOTT ISRAEL[/u]

Name: Anonymous 2013-06-14 21:25

>>35
AS-SALAMU ALAYKUM, MUSLIM BROTHER

KILL KIKES KILL KIKES KILL KIKES

Name: Cudder !MhMRSATORI!fR8duoqGZdD/iE5 2013-06-15 5:52

C/C++ also has long shutdown times, because of a lot of free calls in destructors and malloc managing scheme being inherently inefficient
The Value Grinder might disagree, but that's easily solved by just letting the OS blow away the whole process.

Name: Anonymous 2013-06-15 15:50

need to thrown out from C++:
1. all OOP,
2. overloading, including the operators
3. referenses,
4. templates
5. exceptions
add LUA as standard library
and replace preprocessor to PHP
that's all

Name: Anonymous 2013-06-15 16:07

>>38

Are you going to post this on every single thread?

Name: Anonymous 2013-06-15 16:20

>>39
no

Name: Anonymous 2013-06-15 20:52

>>40
Can I?

Name: Lambda A. Calculus !!wKyoNUUHDOmjW7I 2013-06-15 22:28

>>34
I'M GONNA GO OVER TO UR MUM'S HOUSE, KICK DOWN DA FUCKING DOOR, AND SHOVE A COPY OF DA STANDARD RIGHT UP UR RUSSIAN ASSHOLE, YA FUCKING RETOID.

Name: Anonymous 2013-06-15 22:32

>>42
I don't have a copy of the standard, but I don't like having things shoved up my asshole. Can you upload it somewhere instead?

Name: Anonymous 2013-06-15 22:59

NE1 GOT SUM DUBZ??????????

Name: Anonymous 2013-06-15 23:19

>>4
nice

Name: L. A. Calculus !!wKyoNUUHDOmjW7I 2013-06-16 0:23

>>43
I STOLE PHYSICAL COPIES FROM DA ISO BACK IN DA DAY. DONT GOT NO ELECTRONIC COPIES, BUT U CAN GET DA DRAFTS EASY AS SHIT IF YOU LOOK AROUND. IT'S DA SAME SHIT ANYWAY, SO WHO GIVES A FUCK.

Name: Anonymous 2013-06-17 14:31

We have a guy that demands that we write out every trivial detail of copying this or that or marking this or that as const as if it improves the quality of our software. We have to do that because the guy is the butt-shoving prostate massager, I mean, byte-saving project manager

Name: Anonymous 2013-06-17 16:10

>>47
Get back to pounding those keys monkey-boy.

Name: Anonymous 2013-06-17 16:12

>>47
Sounds like he knows what's up.

Name: Anonymous 2013-06-17 18:14

>>49
yeah, my dick

Name: Anonymous 2013-06-17 19:16


std::vector<std::vector<int>> vec;
std::vector<int> nums = {1,2,3,4};
vec.push(std::move(nums));


fag

Name: Anonymous 2013-06-17 20:33

Name: Anonymous 2013-06-17 20:39

Name: Anonymous 2013-06-19 3:11

Tags for fags
links for chinks

Name: Anonymous 2013-08-27 13:51

check 'em

Name: Anonymous 2013-08-27 14:23

When you have "automatic" memory management but no GC, you have to make copies. You could try reference counting, but it doesn't work with cycles.

Name: Anonymous 2013-08-27 15:15

How are you measuring this ``copying''?
If you're putting a print statement in your copy constructor then it's no surprise it's forced to call it since you made it have side effects.

Don't change these.
Name: Email:
Entire Thread Thread List