[ / / / / / / / / / / / / / ] [ dir / agatha / builders / caos / choroy / flutter / h8s / shota / wooo ][Options][ watchlist ]

/tech/ - Technology

You can now write text to your AI-generated image at https://aiproto.com It is currently free to use for Proto members.
Name
Email
Subject
Comment *
File
Select/drop/paste files here
* = required field[▶ Show post options & limits]
Confused? See the FAQ.
Expand all images

File (hide): c6e5b0eeb028160⋯.jpg (22.95 KB, 215x176, 215:176, scott meyers.jpg) (h) (u)

[–]

 No.872427>>878725 >>878740 >>879114 >>879178 >>881344 [Watch Thread][Show All Posts]

Defend this if you can


#include <iostream>
#include <memory>

int main () {
std::unique_ptr<int> orig = std::make_unique<int>(5);
std::cout << *orig << "\n";
auto stolen = std::move(orig);
std::cout << *orig << "\n";
}

 No.872434>>872435

File (hide): ce839fb0c9f7f52⋯.png (56.27 KB, 621x702, 23:26, vO7lRZ7.png) (h) (u)

5
Segmentation fault (core dumped)

what were you expecting


 No.872435>>872436 >>879492

>>872434

I was expecting to prove c++ is NOT memory safe and i was right


 No.872436>>881253

File (hide): 9871201dba97387⋯.png (16.22 KB, 620x581, 620:581, xNBQyu1.png) (h) (u)

>>872435

yep you are right


 No.872446>>878722 >>878759 >>878796 >>879492

What's more annoying is having to type "std::cout <<" just to print something. Why do that when I can just "print" or "write".


 No.872453

File (hide): 0a9e54050008a64⋯.jpg (10.35 KB, 250x250, 1:1, steve-klabnik.jpg) (h) (u)



fn main() {
let orig = Box::new(5);
println!("{}", orig);
let stolen = orig;
println!("{}", orig);
}

warning: unused variable: `stolen`
--> src/main.rs:4:9
|
4 | let stolen = orig;
| ^^^^^^
|
= note: #[warn(unused_variables)] on by default
= note: to avoid this warning, consider using `_stolen` instead

error[E0382]: use of moved value: `orig`
--> src/main.rs:5:20
|
4 | let stolen = orig;
| ------ value moved here
5 | println!("{}", orig);
| ^^^^ value used here after move
|
= note: move occurs because `orig` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait

error: aborting due to previous error

error: Could not compile `playground`.

To learn more, run the command again with --verbose.


 No.872458

dasfsdsgd

Try to compile that. If it won't, your language is shit.


 No.878630

>>878615

But does it implement the System V ABI? If I compile a rust library, do I get an ELF with symbols that can be loaded and discovered by anyone? Can I load and use a rust library from python?

No? Then kill yourself.


 No.878631

Defend this if you can

int main()
{
int* op_is_a_faggot = nullptr;
return *op_is_a_faggot;
}
Wow, just wow. something something muh memory safety! C++ btfo XDDDD


 No.878637

File (hide): d0425a479be5fd1⋯.jpg (28.02 KB, 1000x159, 1000:159, 1425442687590.jpg) (h) (u)


print('OP is a cunt')
print('Stop fucking posting.')
print('Please delete System32 because I know your dumb ass runs windows')

Please run the above code in Python for a special message.


 No.878676>>878759

File (hide): 6d2b4ea345f3d4b⋯.png (785.06 KB, 2955x2785, 591:557, rust shill hd.png) (h) (u)

>being the meme


 No.878680>>878694

Paste this into your browser console for a special message.


[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]+(![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]()[+!+[]+[!+[]+!+[]]]+([][[]]+[])[+[]]+(!![]+[])[+!+[]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(![]+[])[+!+[]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(![]+[])[+[]]+(![]+[])[+!+[]]+(+![]+[![]]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]()[+!+[]+[!+[]+!+[]]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]])()


 No.878694>>878719

>>878680

I don't have a browser console because I don't feel the need to fuck around typing Jewvascript into my computer. Using other people's Jewvascript is bad enough.


 No.878699>>878723 >>878833

File (hide): 09ee0f9147e7bdd⋯.jpg (108.63 KB, 900x900, 1:1, fagioli2.jpg) (h) (u)

Related question. How do I deliberately gimp Rust compiler / Rust library etc. in a system, so that I never accidentally run something written in Rust? Also can somebody list all Rust related projects so that I can uninstall and avoid them?


 No.878719

>>878694

I seriously hope this is bait


 No.878722

>>872446

>using namespace std;


 No.878723

>>878699

rust dependencies are statically linked in.


 No.878725>>878834

>>872427 (OP)

Why do you want to stagnate programmer wages by opening up our career field to normalfags? Are you Jewish?


 No.878740

>>872427 (OP)

The cost of freedom.


 No.878759>>881287

>>878676

10/10

>>872446

Oh yeah, typing "std::println!("format {} arguments", "some");" is much better i agree!


 No.878796>>878800 >>878832 >>879492

>>872446

#define print std::cout


 No.878800>>878805

>>878796

>

print << "string";

kill yourself


 No.878805

>>878800

I don't know what their problem with cout is so it was just a retarded suggestion


 No.878830>>879492

you invoked undefined behaviour, so you got a crash. If you don't want to bother with this (like a lazy nigger that you are) just program in java. At least i won't ever see or use your code for sure.


 No.878832>>878867 >>878884

>>878796

#define print std::cout <<
#define and <<

#include <iostream>
#include <memory>

int main () {
std::unique_ptr<int> orig = std::make_unique<int>(5);
print *orig and "\n";
auto stolen = std::move(orig);
print *orig and "\n";
}


 No.878833

>>878699

any reasons to do so?


 No.878834

>>878725

they won't be able to program anyway.

even without UB this is not for everyone.


 No.878867

>>878832

brilliant


 No.878884

>>878832

>includes library that has the substring "and" anywhere

>substituted for <<

>code fails to compile

>happy debugging fuckers


 No.878888>>878951

I got lucky that my CS school taught C++, because then I knew to avoid it for the rest of my career. It's a shame I can't find a job writing OCAML; now that's a beautiful language.


 No.878914>>879068 >>879492

I thought one of the biggest advantages of C/C++ was the fact that you had direct memory address access for your program? Wouldn't you technically want this depending on how low level you are going?


 No.878922>>879492

Just use C


 No.878951

File (hide): c57e014baac074c⋯.png (510.81 KB, 611x457, 611:457, hibernian conspiracy.png) (h) (u)

>>878888

>O'Caml


 No.879068>>879087 >>879492

>>878914

This is correct.

>Wouldn't you technically want this depending on how low level you are going?

This is also correct, but people aren't always correct about when to go low level. /tech/ is particularly bad at this, considering we think low level = always faster = always better, so they always like to go low level and thus introduce thrice as long development times and more often than not unintended serious vulnerabilities for the end user.


 No.879087>>879163

>>879068

There are maybe 3 people who are good at programming on /tech/

Everyone else is an underage LARPer


 No.879114>>879492

>>872427 (OP)

You sacrifice memory safety for speed. That's why c++ is only used by competent programmers and not just any old retard


 No.879163>>881306

>>879087

All those old /g/ projects that never got beyond arguing over a logo were the manifestation of this. I'm one of the few gentoomen who ever wrote a program that was even remotely note worthy.

Fuck, this board's gone to shit.


 No.879178>>879252

>>872427 (OP)

>being this nonwhite

I repeat.

Plastic is not some kind of weird translucent wood.

I know your backwater people are used to dropping things on the floor and have them rot away, but that doesn't happen with most plastics.

But, alas, such is the mind of the nonwhite, always lagging decades behind.


 No.879252

>>879178

>But, alas, such is the mind of the nonwhite, always lagging decades behind.

Absolutely. C++ still hasn't caught up to what white people were doing in the 70s.


 No.879492>>879934

>>872435

Next show us x86 assembly isn't memory safe. Surprising, isn't it? Learn assembly. Stop being an asslicking retard.

>>872446

Agree. Having to use << std::endl instead of \n and an occasional fflush() is even worse.

>>878796

No. Please stop.

>>878830

This.

>>878914

>asking if there is a reason to understand how a computer works and to make use of the actual hardware, at the hardware level.

This is bait right? This isn't an actual discussion point for modern programmers? If it is, we are lost.

Learn assembly. Write a simple text editor in macro assembly.

>>878922

Reasonable answer.

>>879068

I think suggesting they consider the end user at all is disingenuous. "they" are mostly javashit monkies, rustfags, and "coders" who are trying to convince me VSCode is good. They clearly don't give a fuck about the end user. But yes, going low-level without reason is dumb too. Anyway, Intel and AMD are fucking over branch optimizations and cache is reasonable to deal with. Might as well learn assembly you faggots. Nothing to lose now.

>>879114

"I don't understand how puters work so I use Rust" is not a recipe for memory safety or exploit-free code.


 No.879934

>>879492

>Agree. Having to use << std::endl instead of \n and an occasional fflush() is even worse.

std::endl; tends to be a big performance issue as it actually forces a flush. Most people don't even know it does that. For higher performance things you should just std::cout << "hello world\n";

>Next show us x86 assembly isn't memory safe.

Computers should tell us when something is fucked so that we don't introduce bugs into our program.

>is not a recipe for memory safety or exploit-free code.

No, but its a much better start.


 No.881253

>>872436

>typical C/C++ programmer.png


 No.881287>>881307

>>878759

>Oh yeah, typing "std::println!("format {} arguments", "some");" is much better i agree!

Pascal has just "writeln" and that's good design.


 No.881306

>>879163

How are you so sure? I've writen lots of projects that have actually seen use by communities. The thing is I did it under my real name and I would never post them here.


 No.881307

>>881287

>writeln

>ln

>good design


 No.881323

Rust wins again:

use std::fmt::{self, Formatter, Display};
use std::ops::{Shl};

static stdout: Stdout = Stdout;
static endl: Endl = Endl;

#[derive(Clone, Copy)]
struct Stdout;

#[derive(Clone, Copy)]
struct Endl;

impl<D: Display> Shl<D> for Stdout {
type Output = Self;

fn shl(self, msg: D) -> Self {
print!("{}", msg);
self
}
}

impl Display for Endl {
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
writeln!(fmt)
}
}

fn main() {
stdout << "Hello" << ", " << "World" << "!" << endl;
}
https://play.rust-lang.org/?gist=4608a9c315f42a64385f0b799dc62482


 No.881344>>881397

>>872427 (OP)

C++ was never anything more than a joke, it doesn't need to be BTFO


 No.881397

>>881344

I guess thats why nothing that needs to be fast is written in it.




[Return][Go to top][Catalog][Screencap][Nerve Center][Cancer][Update] ( Scroll to new posts) ( Auto) 5
47 replies | 8 images | Page ?
[Post a Reply]
[ / / / / / / / / / / / / / ] [ dir / agatha / builders / caos / choroy / flutter / h8s / shota / wooo ][ watchlist ]