[ / / / / / / / / / / / / / ] [ dir / animu / ausneets / f / fascist / hkpol / m / vg / vichan ][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.
Email
Comment *
File
Select/drop/paste files here
Password (Randomized for file and post deletion; you may also set your own.)
* = required field[▶ Show post options & limits]
Confused? See the FAQ.
Expand all images

New Volunteer

File (hide): c1e265188b2f991⋯.jpg (2.43 MB, 2988x5312, 9:16, IMG_20180531_090207.jpg) (h) (u)

[–]

 No.937668[Watch Thread][Show All Posts]

Go

 No.937673>>937689 >>937697

You may not like it, but this is what peak memory safety looks like:



const STRING: &'static str = "Hello, World!";

fn main() {
let stdout: ::std::io::Stdout = ::std::io::stdout();
let mut locked_stdout: ::std::io::StdoutLock = ::std::io::Stdout::lock(&stdout);

let mut i = 0;
while i < STRING.as_bytes().len() {
match ::std::io::Write::write(&mut locked_stdout, &STRING.as_bytes()[i..]) {
Ok(len) => {
i += len;
}
Err(ref e) if ::std::io::Error::kind(&&*e) == ::std::io::ErrorKind::Interrupted => {}
Err(ref e) if ::std::io::Error::kind(&&*e) == ::std::io::ErrorKind::BrokenPipe => {
break;
}
Err(e) => {
panic!(e);
}
}
}

::std::io::Write::flush(&mut locked_stdout).unwrap();
}
https://play.rust-lang.org/?gist=91d8456658660df8e795bebd39e25f28&version=stable&mode=debug&edition=2015


 No.937689>>937695 >>937697

>>937673

Jesus Christ it's unreadable.


 No.937695

>>937689

Well, it's a gore thread.


 No.937697>>937702 >>937752 >>939709

>>937673

>>937689

Sorry I made a few mistakes (I'm still a Rust rookie :) Don't be too hard on me :))).

const STRING: &'static str = "Hello, World!";

fn main() {
let stdout: ::std::io::Stdout = ::std::io::stdout();
let mut locked_stdout: ::std::io::StdoutLock = ::std::io::Stdout::lock(&stdout);

let mut i: usize = 0usize;
while ::std::cmp::PartialEq::eq(
&::std::cmp::Ord::cmp(
&i as &usize,
&<[u8]>::len(str::as_bytes(STRING as &'static str) as &[u8]) as &usize,
) as &::std::cmp::Ordering,
&::std::cmp::Ordering::Less as &::std::cmp::Ordering,
) as bool
{
match ::std::io::Write::write(
&mut locked_stdout as &mut ::std::io::StdoutLock,
::std::ops::Index::index(
str::as_bytes(STRING as &'static str) as &[u8],
::std::ops::Range {
start: i as usize,
end: <[u8]>::len(&str::as_bytes(STRING as &'static str)) as usize,
} as ::std::ops::Range<usize>,
),
) as ::std::result::Result<usize, ::std::io::Error>
{
::std::result::Result::Ok(len) => {
match usize::checked_add(i as usize, len as usize) as ::std::option::Option<usize> {
::std::option::Option::Some(j) => {
i = j as usize;
}
::std::option::Option::None => {
panic!("overflow while incrementing index" as &'static str);
}
}
}
::std::result::Result::Err(ref e)
if ::std::cmp::PartialEq::eq(
&::std::io::Error::kind(e as &::std::io::Error),
&::std::io::ErrorKind::Interrupted as &::std::io::ErrorKind,
) as bool => {}
::std::result::Result::Err(ref e)
if ::std::cmp::PartialEq::eq(
&::std::io::Error::kind(e as &::std::io::Error) as &::std::io::ErrorKind,
&::std::io::ErrorKind::BrokenPipe as &::std::io::ErrorKind,
) as bool =>
{
break;
}
::std::result::Result::Err(e) => {
panic!("error writing to stdout: {}", e as ::std::io::Error);
}
}
}

loop {
match ::std::io::Write::flush(&mut locked_stdout as &mut ::std::io::StdoutLock) {
::std::result::Result::Ok(()) => {
break;
}
::std::result::Result::Err(ref e)
if ::std::cmp::PartialEq::eq(
&::std::io::Error::kind(e as &::std::io::Error) as &::std::io::ErrorKind,
&::std::io::ErrorKind::Interrupted as &::std::io::ErrorKind,
) => {}
::std::result::Result::Err(ref e)
if ::std::cmp::PartialEq::eq(
&::std::io::Error::kind(e as &::std::io::Error) as &::std::io::ErrorKind,
&::std::io::ErrorKind::BrokenPipe as &::std::io::ErrorKind,
) =>
{
break;
}
::std::result::Result::Err(e) => {
panic!("error flushing stdout: {}", e as ::std::io::Error);
}
}
}
}
https://play.rust-lang.org/?gist=57f5015d60e64cf016482585ae7640f4&version=stable&mode=debug&edition=2015


 No.937702

>>937697

Real Multics code leaked, AT&T + lispfag salt rivers.


 No.937745

0.0.0.0 1e100.net


 No.937749

anon@t400:~/projects/<company project>$ make test
.................FSSegmentation fault

Quality, as always. Thanks pajeets.


 No.937752>>937755 >>937846 >>937851

File (hide): 71877930919cd1c⋯.png (47.93 KB, 571x390, 571:390, programming_in_a_nutshell.png) (h) (u)

File (hide): 63ed963f6452415⋯.jpeg (33.26 KB, 704x290, 352:145, absolute_cancer.jpeg) (h) (u)

Check out the gcc (or bash) man page if you want gore.

>>937697

I am actually impressed how they've managed to create a language which is uglier than Perl and c++ combined. Those :: are stabbing my eyes. Yet I do admire your enthusiasm, anon.


 No.937755

cargo build --release
Compiling literally_every_rust_project v0.1.0 (file:///path/to/literally_every_rust_project)
Finished release [optimized] target(s) in 3h 21m 57.01s

>>937752

thx


 No.937846

>>937752

Squee, what language lets you use emotes for variables?


 No.937851>>937856

>>937752

Should work if the language supports unicode characters in variable names.


 No.937856

>>937851

I will definitely try that out. Do I get bonus points if I use people of colour emotes, then accuse people who want me to delete them of racism?


 No.939709

>>937697

>:: :: :: :: :: :: :: :: :: :: ::: ::::::::::::::

who the fuck thought this was a good idea? is a . not good enough, or at least a single colon?




[Return][Go to top][Catalog][Screencap][Nerve Center][Cancer][Update] ( Scroll to new posts) ( Auto) 5
13 replies | 1 images | Page ???
[Post a Reply]
[ / / / / / / / / / / / / / ] [ dir / animu / ausneets / f / fascist / hkpol / m / vg / vichan ][ watchlist ]