[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip / qa] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: 1592493017534.png (786 KB, 1280x720)
786 KB
786 KB PNG
>move semantics...
>value categories...
>&& rvalue references...
>universal template references...
>T&& deduces to int&&&& which collapses to int&&....


>in c its just
struct Container
{
LargeObject* object;
};

Container* c = malloc(sizeof(Container));

//take ownership (no need to delete obj in this scope)
c->object = obj;

//dont take ownership of this obj (make own copy instead)
c->object = malloc(sizeof(LargeObject));
memcpy(c->object, obj, sizeof(LargeObject));
>>
in c++ it can be also just
struct Container
{
LargeObject* object;
};

Container* c = malloc(sizeof(Container));

//take ownership (no need to delete obj in this scope)
c->object = obj;

//dont take ownership of this obj (make own copy instead)
c->object = malloc(sizeof(LargeObject));
memcpy(c->object, obj, sizeof(LargeObject));
>>
>>101202007
>my dad was a genius and i live off of the money he made therefor i live off of my own genius
>>
So true anon, C has none of those pesky lvalues or however indians program.
$ gcc lvalue.c
lvalue.c: In function 'main':
lvalue.c:3:8: error: lvalue required as left operand of assignment
3 | 42 = "op is a retarded nigger";
| ^
>>
>>101202069
difference is you dont have to think about it in c

unless you're a retard who tries to assign values to the number 42
>>
>>101202100
is this why c programs have so many buffer overruns, retards who can't think feel confortable in writing a language where you unfortunately have to think?
Retarded niggers who claim that not thinking is a feature shouldn't be trusted, so I won't be caring about C, wow, it's just like Rust, where trannies are afraid of thinking, no wonder that Rust codetroons are just tourists from C...
>>
>>101202143
when i imply you dont have to think about its because there is no way you can fuck it up

unlike in sepples where you have to think about it precisely BECAUSE it can fuck up
>>
>>101202169
C has most CVE's out of any programming language precisely because of low IQ morons like you
>>
>>101202187
c is the most widely used programming language in system level software development, seconded by c++ which im sure is also seconded in CVEs
>>
>>101202206
yeah, because people who use C++ think more, there's less code (lack of boilerplate) and less bugs (lack of retards), meanwhile all retards flock to C, even your own thread says that C is for retards
>>
File: 1592481191865.gif (73 KB, 512x512)
73 KB
73 KB GIF
>>101202226
linus torvalds (the most thinking software developer there is) swears by c and hates c++. RMS (the second most thinking software developer) too.
>>
>>101202247
one is a retard who hates GPL3 and other is a retard who loves binary blobs in his body
>>
>>101202257
what if i told you you have binary blobs INSIDE YOUr system right now?

what if i told you you probably have GLP3 programs inside your system as well.
>>
in Rust this is just
//take ownership (no need to delete obj in this scope)
let c = obj;

//dont take ownership of this obj (make own copy instead)
let c = obj.clone();
>>
>>101202264
see, you're not even intelligent enough to comprehend which one is good and which one is bad
>>
>>101202291
im well aware which one is good and which one is the literal spawn of satan, are YOU?
>>
>>101202317
yes, Linus Torvalds and Stallman kikefaggot are spawns of satan and I am good.
>>
>>101202325
not untrue
>>
>>101201911
thats a lot of memory you're leaking there anon
>>
>>101203103
you can imagine the freeing up part yourself
>>
>>101203122
can you imagine the part where you don't use garbage that is malloc?
>>
>>101203146
sure i'll allow you to imagine that
>>
>>101203167
I don't need to imagine as I don't use garbage like malloc, but can you?
>>
>>101203173
i can do anything you can do x10
>>
>>101203184
yes I know that you can use x10 more memory to solve a problem x10 slower while having x10 more lines of code
>>
>>101202007
reads much better than the c version desu
>>
>>101201911
C++ is worth using over C almost just for std::unique_ptr and proper ADTs alone
>>
>>101202007
C++ doesnt have memcpy though, everything goes on the stack
>>
>>101201911
You forgot temporary materialization
>>
>>101206331
you're getting a little confused. C++ doesn't have a stack, everything goes on the heap
>>
>>101201911
sepple lets me integrate a working 500 lines of code within one function in 2 days.
In C that takes 4 days.
I will keep using sepple.
>>
>>101206895
no you can't memcpy it all goes in the registers every even memory you cna't just copy it



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.