[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 399
Thread images: 34

File: dozens.gif (2MB, 385x215px) Image search: [Google]
dozens.gif
2MB, 385x215px
Old thread: >>61447463

What are you working on, /g/?
>>
yeah, chapel really is the best language.
>>
File: 1490171538648.jpg (668KB, 716x960px) Image search: [Google]
1490171538648.jpg
668KB, 716x960px
I just ordered some new programming socks off amazon!
>>
File: average dpt discussion.png (2KB, 436x23px) Image search: [Google]
average dpt discussion.png
2KB, 436x23px
first for bits are just an abstraction on top of bytes and registers
>>
>>61451920
Whys that?
I like to procrastinate with new toylangs.
>>
>>61451921
cat face says it all
>>
>>61451921
>>>/b/ or >>>/soc/

>>61451928
New language designed for high performance computers and cluster.
>>
>>61451921
Post cute soles while you have a dildo up your cute little trap ass :3
>>
File: V.webm (1MB, 854x480px) Image search: [Google]
V.webm
1MB, 854x480px
Tiling script for KWin. It's one of the first things I've ever written or done programming-wise (first Javascript) and it's getting out of hand.
>>
>>61451928
http://chapel.cray.com/
>>
>>61451942
>>61451954
I'd like to hear your personal account why though.
>>
>>61451928
>toylangs
I've read this as toryfags.
>>
Learn some Rust you fags

fn add2(x: i32, y: i32) -> i32 {
// Implicit return (no semicolon)
x + y
}
>>
>>61451979
>// Implicit return (no semicolon)
Why would I want to learn this shitlang?
>>
>>61451949
source?
>>
>>61451984
The code is very messy, partly because of the stupid scripting api making things overly complicated. I also have no fucking idea how people use their desktops and I've always adjusted it to my own use.

https://github.com/Jazqa/kwin-quarter-tiling
>>
>>61451979
>all that verbosity
auto add(int a,int b) pure
{
return a + b;
}

>>
>>61452020
>pure
what is this?
>>
fn add2(x: i32, y: i32) -> i32 {
// Implicit return (no semicolon)
x + y
}

fn main() {
println!("the result is: {}", add2(13, 15),); // prints the result is: 28
}




Now you saw a complete Rust program and know that the compiler is rustc

It's too late to go back now.
>>
>>61452026
assurance that said function is pure.
>>
>>61451979
>explicit typing
ew

>>61452020
Seems cancerous, why would you need to write pure?
Also why the int?

(define (add x y) (+ x y))
Here you go.
>>
>>61452034
I guessed, but what language? I don't believe sepples has that
>>
>>61452039
auto add(T)(T a, T b) pure
{
return a + b;
}

>>61452041
D
>>
File: 1496002125704.jpg (508KB, 977x799px) Image search: [Google]
1496002125704.jpg
508KB, 977x799px
>>61452030
*pukes*

>>61452057
Absolutely disgusting, templates are cancer.
>>
>>61451968
It has really simple C interface and if you use clang backend you can basically just import C header and be done with it. This is really the biggest reason why I stopped looking at Ocaml and tried Chapel instead.
It has type inference and the syntax looks clean.
// statically typed, beatiful and clean
proc fn(type t, x) {
var tmp:t; // declaring variable with type t, don't really need it if the compiler can ques it
tmp = get_type_t(x);
}

// ugly java shit
void fn<T>(Object x) {
T tmp = get_type_t<T>(x);
}

It's desinged for parallelism and at least the build in operations seems really easy to use.
// might run parallel, actually it depends on how many task are currently running
begin {
fn();
fn2();
}
sync(); // wait for fn and fn2 to finish.

I have no idea how the locales and other stuff work in it but the language supports running stuff in GPU if you want to. So I ques the parallelism stuff looks good for the future, also it's not tied to any big company or platform like Apples swift which seems to have at least similar syntax.
>>
>>61452068
t. only bases his opinion on Sepples templates
>>
>>61452082
Nope, I clearly based my opinion on the D template that was shown to me just a few posts before.
>>
>>61452082
please show us your one true template
>>
>>61452074
Looks disgusting.
Please stop shilling your shitty language that ignores thousands of years of CS research please.
>>
>>61452092
Youll call anything thats not lisp, heresy.
>>61452094
?, D just makes things simpler desu, nothing special.
>>
>>61452118
>Youll call anything thats not lisp, heresy.
No, I will call anything that's a shitty language, heresy.
>>
>>61451921
quality /dpt/ thread, guys
>>
>>61452074
Not crazy on the syntax, but seems like a modern pascal flavor.
>>
>>61452118
templates are ass
use real polymorphism
>>
>>61452030

these are ways to initialize immutables (constants) in Rust
 let x: i32 = 1;
let y: i32 = 13i32;
let f: f64 = 1.3f64;



if you want mutables you should use let mut
 let mut m = 11;



arrays and ranges:


let array = [1, 2, 3];
for i in array.iter() {
println!("{}", i);
}


for i in 0u32..10 {
print!("{} ", i);
}



now use Rust you fags, you know you want to
>>
File: 1489109466722.jpg (243KB, 1920x1080px) Image search: [Google]
1489109466722.jpg
243KB, 1920x1080px
>>61452110
Holy shit, this is pure cancer.
>>
File: 1499957517472.jpg (179KB, 1920x1080px) Image search: [Google]
1499957517472.jpg
179KB, 1920x1080px
>>61452141
>>61452136
C A N C E R
>>
>>61452136
conditionals don't need parenthesis in Rust

if a == b {
println!("equal");
} else {
println!("not equal");
}

while 1==1 {
//do shit
}

>>
>>61452183
pls make it stop
>>
>>61452123
Why is it bad?
>>
>>61452192
It causes permanent brain damage.

>>61452183
{} are forced in rust
println is a thing (instead of a print where you just add a \n)
println! meme
Not using their shitty style causes warnings https://github.com/rust-lang/rust/issues/41646
>>
61452214
>i just want to shitpost and actually have no argument
got in
>>
>>61451907
Look at this wicked fizzbuzz.

main(i){for(;i<101;puts(i++%5?"":"buzz"))printf("%i\r%s",i,i%3?"":"fizz");}
>>
>>61451900
C's type system is pathetically weak. Types in C are simply an afterthought, and this is painfully obvious in declarations. OOP is all about defining your own types and the operations which are valid over them. Pasting a system that demands strong typing into a language that tried its hardest to sweep types under the rug is a mistake.
So the first casualty of C++ is the declaration syntax, which is conceptually fucked. C declarations follow usage, C++ declarations follow typing. The majority of C++ programmers try their best to ignore that and write utter garbage like this just to achieve some perceived consistency.
int* ptr;

There are three or four different ways to initialize your objects and half of them break if you look at them funny. They overlap and contradict in usage and behavior, and fight against the old C usage-oriented declaration syntax.
vector<int> a(10);
vector<int> b{10};
vector<int> c(10, 20);
vector<int> d{10, 20};
vector<int> e = {10, 20};
vector<int> f;
vector<int> g();
vector<int> h{};

Sepples trips at the first hurdle, you could pick any aspect apart with this much autistic scrutiny and it wouldn't be difficult. Templates and STL are another easy target, the syntax for templates is arcane and has bizarre restrictions while the STL is full of unchangeable past mistakes like non-RAII streams, ::type and ::value bullshit, even crap that's retarded but only awkward like vector<bool>.

I hate sepples, but I don't know what's better.
>>
>>61451979
>not generic
fuck off faggot
fn add2<T: std::ops::Add>(a: T, b: T) -> T {
a + b
}
>>
>>61452260
Rust is an embarrassing language.
>>
>>61452260
>templates
>generic
>>
>>61452260
>not generic

it's a gentile introduction but thanks

please keep showing people how to declare generic classes and so on
>>
>>61452279
I don't really care about what you think. It's fast, the only bugs I get are logic bugs and it's maintainable. I'm not forced to use Rust, I'll use other languages when they give me an advantage.
>>
Hello fellow anons.
I want to make a website that have for example 3 squares per row, goes to a instagram account and posts the pictures and videos in each square by date. I have no problem doing this manually but obviously that's not very handy. I'm thinking about getting the instagram html code with python and put the pictures/videos url in a list. Then write that list to a txt and open that with javascript. Is there a better way to do this?
>>
>>61452287
Rust doesn't have templates, not sure what you're trying to say.
>>
>>61452300
>when they give me an advantage.
How about not having to type twice as much to achieve something.
>>
>>61452320
Seems like you've never maintained a big software project or written performance critical code yet.
>>
>>61452312
are they instantiated only at compile time
>>
>>61452331
Literally any simple thing in Rust has extra steps, how would that not scale up as your code grows?
>>
>>61452334
Yes, most of the time these functions get expanded to their native form for every type that calls it. If you use trait objects you'll get a dynamic function with jump tables though,
>>
>>61452260
You call that shit "generic"? You have a lot to learn, kid.
fn add3<T: std::ops::Add<U>, U>(a: T, b: U) -> <T as std::ops::Add<U>>::Output {
a + b
}
>>
>>61452353
>no higher ranked types
>no hkts
>>
>>61452260
>>61452354
Is this a joke? Are we being trolled?

>>61452300
>the only bugs I get are logic bugs
Literally in every language except dependant typing ones?
>>
The rust type system is turing-complete which also happens to mean that it's shit.
>>
>>61452384
Rust TMP when?
>>
>>61452354
Hah, not sure how that stuff works. Thanks though, I'm not an expert at Rust yet. How does the `T as std::ops::Add<U>` work?
>>
>>61452354
thanks for making C++ look compelling
>>
>>61452400
use haskell instead

add = (+)
>>
>>61452375
>go
>hurr durr no generics

>rust
>hurr durr generics are hard
>>
>>61452407
What? Are you retarded?
Nobody posted anything about Go in this thread and the complains about Rust are not about "generics" being hard, they are about templates being shit, it's lack of proper parametric polymorphism and type inference.
>>
>>61452354
why is it so restrictive btw?
> error[E0277]: the trait bound `i64: std::ops::Add<i32>` is not satisfied
>>
>>61452375
>>61452398
>>61452400
You are all such babies. I'm just getting started.
fn add4<T: std::convert::Into<V>, U: std::convert::Into<W>, V: std::convert::From<T> + std::ops::Add<W>, W: std::convert::From<U>, X: std::convert::From<<V as std::ops::Add<W>>::Output>> (a: T, b: U) -> <V as std::ops::Add<W>>::Output {
(a.into() + b.into()).into()
}

fn main() {
println!("{}", add4::<_, _, i32, i32, i32>(1, 2));
}
>>
>>61452425
I was talking about the general consensus of Go in /g/. Rust's generics aren't templates. Rust's generics check whether the passed type implements the required traits that you specify in the function header, it isn't just dumb function expanding. Here's a good article on the differences: https://locka99.gitbooks.io/a-guide-to-porting-c-to-rust/content/fixing_problems_in_c_cpp/templates.html
And what's wrong with Rust's type inference? And what is wrong with Rust's parametric polymorphism?
>>
>>61452470
A CPU can't add an i32 and an i64. If you really want to add an i32 and an i64, you could use type casting.
let a: i32 = 3;
let b: i64 = 5
let c = add(a as i64, b);
>>
>>61452500
Honestly, the lack of implicit integer conversions is just a fucking pain in the ass.
>>
>>61452481
>And what's wrong with Rust's type inference? And what is wrong with Rust's parametric polymorphism?
They literally do not exist, this is what is wrong.
>>
>>61452511
>type inference doesn't exist
https://rustbyexample.com/cast/inference.html

>parametric polymorphism doesn't exist
https://doc.rust-lang.org/1.11.0/book/generics.html
>>
>>61452500
>A CPU can't add an i32 and an i64
A language that cares so much about a specific CPU architecture can't be called sane nor high level.
Same goes for i32/i64 types instead of being able to have a iN type where N can be any number or ranges like ada.
>>
>>61452524
>https://rustbyexample.com/cast/inference.html
Great, now try it on a function argument.

The fact that it is possible to do it for variables also shows how rust does not have any mathematical background, after all "let" is implemented over a lambda in lambda calculi.

>https://doc.rust-lang.org/1.11.0/book/generics.html
Just proves my point.
>>
>>61452500
I just thought since the return type is i64 why the fuck can't it do a non-narrowing conversion?
>>
>>61452511
>>61452541
Can you please fuck off.
>>
>rust
>i64 = i32 + i32: hurrrr error!! (can't overflow)
>i64 = i64 + i32: not error ;) (can overflow)
Why is rust so shit?
>>
>>61452557
Get out of here rust shill.

>someone talked badly of my shitty language, oh no ;_;
>>
>>61451921
Show benis
>>
>>61452560
muh language that achieves safety by being so bad nobody would use it so there can't be any harmful software written in it.
>>
>>61452560
it's not a overflow issue, they're just stupid and didn't integrate the concept of non-narrowing into the language
>>
>>61452560
oops, meant
>i64 = i64 + i64
Instead of
>i64 = i64 + i32
>>
>>61452572
I'm not a Rust user, I just think that you're a retarded faggot who probably uses some ultra hipster FP language.
Fuck off. We only do real programming here.
>>
File: xkcd-haskell.png (12KB, 225x321px) Image search: [Google]
xkcd-haskell.png
12KB, 225x321px
>>61452576
Reminds me of this

>>61452592
>rust
>real programming
??
>>
I-I like C and Ruby... Why does nobody talk about god ol' reliable C and /comfy/ Ruby?
>>
>>61452601
As I said, I'm not a Rust user.
>>
>>61452586
The point is that it throws an error on a safe expression while it does not care at all on an expression that could cause overflow issues. This is just a side effect of what you said indeed.
>>
>>61452615
>Why does nobody talk about god ol' reliable C
Lots of people talk about C.
>>
>>61452615
it's 2017 and programming must be made difficult if we want to keep the money flowing our way
>>
>>61452615
>reliable C
>>
File: 1484404871750.jpg (188KB, 1920x1080px) Image search: [Google]
1484404871750.jpg
188KB, 1920x1080px
>>61452615
H-Hi
H-how is the client going? I haven't worked on it the last days ;-;
>>
>>61452615
C is trash.
It has no type safety and no modern features for productive and safe programming.

>C
>Reliable
Don't make me fucking laugh.
Just look at all those CVE's.

t. Former C programmer.
>>
<<61452635
(You)
>>
>>61452635
Sadly this is true for most modern languages.
>>
>>61452601
I don't understand. I thought all the Rust zealots disappeared once they became the laughing stock of the internet with
>When are you going to rewrite it in Rust?
Why did they come back from under the rock they have been hiding?
>>
>>61452644
No, it's only C.
>>
>from importlib import import_module as _import
>>
>>61452653
Not true.
>>
File: awkward_programming_neet.jpg (164KB, 620x500px) Image search: [Google]
awkward_programming_neet.jpg
164KB, 620x500px
>>61452632
I-Is that Mikoto-chan?...
(゚д゚;)
>>
>>61452667
Yes, it is true.
The majority of CVE's come from C software.
All other modern languages have plenty of productivity features and at least better type safety than C (excluding the trash dynamically typed languages). C has none. C is even more of a joke than Go.
>>
>>61452691
>The majority of CVE's come from C software.
Because most software the people give a shit about is written in C.
>>
>>61452678
>awk
who sed this
>>
>>61452691
>The majority of CVE's come from C software.
Because people only care about and use C software.

>dynamically typed languages
No such thing
>>
>>61452601
Rust programming is far more real than whatever trash >>61452541 uses.
>>
>>61452711
get a grep of yourself, nobody did
>>
>>61452716
>>>61452601(You)
>Rust programming is far more real than whatever trash >>61452541(You) uses.
Doubt
>>
>>61452702
Every single CVE has been due to C being a shit, and having no type safety or other kinds of safety at all.
And C not having any productivity features force C programmers to work around it with terrible buggy hacks that cause even more CVE's.
>>
>>61452725
i can't believe sudid that
>>
>>61452702
this, desu

the whole infrastructure is written in C
>>
>>61452678
Y-Yes, h-how are you qtπ? (。>﹏<。 )

>>61452711
>>61452725
Kawaii desu
>>
>>61452713
Exactly this.
>There are only two kinds of languages: the ones people complain about and the ones nobody uses.
>Bjarne Stroustrup
>>
So I have an iq of 70 and for once I made something to helps me learn basic maths.

>Might make something for English (little complex)

import java.util.Scanner;
import java.util.Random;

class Maths
{


public static void main(String args[])
{
Scanner in = new Scanner(System.in); // System in object

System.out.println("Please select an option out of the below menu");
System.out.println("For multiplication questions please enter" + "the number 1");

int answer = in.nextInt();
if (answer == 1)
{
System.out.println("How high do you wish to multiply to? ");
int multTableNum = in.nextInt();

System.out.println("How many questions do you wish to have 1-100? ");
int numberQuestions = in.nextInt();

for (int i = 1; i < numberQuestions; i++)
{
System.out.println("Question number " + i + "/" + numberQuestions);
int number1 = (int) (Math.random() * multTableNum + 1);
int number2 = (int) (Math.random() * multTableNum + 1);

System.out.println("What is " + number1 + " multiplied by "
+ number2 + " equal? ");

int multiplyAnswer = in.nextInt();
if (number1 * number2 != multiplyAnswer)
{
System.out.println("Sorry that answer is incorrect");
}

else
{
System.out.println("You're correct, next question \n");
}

}
}
}
}
>>
File: 1478651626250.jpg (106KB, 677x717px) Image search: [Google]
1478651626250.jpg
106KB, 677x717px
>>61452745
not as kawaii as you mikoto-chan
>>
>>61452751
he would say that wouldn't he
>>
>>61452754
I feel like I could summarize this but holding back the online searches is how you become a programmer.

Feedback anyone?
>>
>>61452745
N-No... yo-you are c-cuter than m-me .. Mikoto-chan ...
・゚。(///>﹏<///)。・゚・
>>
>>61452702
>>61452713
>>61452738
Keep deluding yourself.
C doesn't get the majority of CVE's because "everyone uses it", that's a stupid excuse.
It doesn't matter how much attention your software is getting, you shouldn't be getting any CVE's.
It's simple to avoid getting so many CVE's, just use a proper type safe language with actual productivity features.
>>
File: 1494332105752.jpg (733KB, 3702x2198px) Image search: [Google]
1494332105752.jpg
733KB, 3702x2198px
>>61451983
Actually, Rust is not the only expression based language
>>61452068
There is nothing wrong with templates.
>>61452260
Now this looks bad
>>61452560
>(can't overflow)
No that's not it
>>
File: 1369446960901.png (20KB, 256x310px) Image search: [Google]
1369446960901.png
20KB, 256x310px
The rust shills really are out in force today.
>>
>>61452779
Can you please fuck off.
>>
>>61452781
Why is it (T) in the declaration but !(T) in the usage?
>>
>>61452786
I'm not a Rust user.
I'm just saying that C is trash because it is.

Rust is also trash because the borrow checker is way too course and yells at you about perfectly correct code.
>>
>>61452762
I had a mate bitch and bitch about Java and yet used c++ (so he said).

Later I used C++ to learn that the cunt lied. I wasted no time to call that cunt out.

C++ both required things this cunt bitched about.

I just don't get why people try and lie about programming when there is not really any languages out there that is easy to learn while providing nothing to hate.
I guess it powerful to call a cunt out...

>ima fuck off now
>>
>>61452777
Looks cool anon. Now make something more difficult!

>holding back the online searches is how you become a programmer

mmmm bad attitude to have in my opinion. Yes, struggling with stuff is going to help you out a lot. But getting advice online is exceptionally useful and almost always necessary when creating something complex.

The issue with reviewing what you've shown us is that it's limited in scope. Just challenge yourself to do new stuff. Maybe make a small console-based text adventure that requires more classes.

FWIW, I'm not a java programmer but what you wrote looks correct to me.

Check out codereview.stackexchange.com. This isn't a good place to get your code reviewed.
>>
File: 1485623899959.jpg (25KB, 572x720px) Image search: [Google]
1485623899959.jpg
25KB, 572x720px
>>61452756
*blush*
Y-you too

>>61452779
I-Impossible! Asuna-chan is topcute!
I-I will start working on the c-client again today :3

>>61452791
No bul my (future) gf, BAKA!
>>
File: 1499075237453.jpg (75KB, 693x960px) Image search: [Google]
1499075237453.jpg
75KB, 693x960px
>>61452811
>>
>>61452818
I-I only did a-a little work too... I-I ... tried to reorganize the project....
>>
>>61452814
as you can see in the posts around mine, people are having the same autistic C vs. Rust debate for the 10 thousandth time. Go somewhere serious people can help you.
>>
>>61452780
Pointers make everything complex.

If you were using them you could literally turn your program into a memory exploit tool.
My point, every piece of software can be used in a flawed designed manner. Don't think not having flaws is good as it just means that it has not been reported.

Besides only software that would matter to someone would get audited with security sweeps
>>
File: 1462970641659.png (754KB, 736x715px) Image search: [Google]
1462970641659.png
754KB, 736x715px
I just wrote a recursive function with 12 arguments.
I think this is pushing the limits of too many arguments.
>>
>>61452846
put them in a record
>>
>>61452844
>He thinks it's impossible to make pointers safe to use
>>
>>61452852
>he
>>
>>61452811
allegedly Java and C# are easiest to learn

with C++ you're not learning productive shit like a good standard library just a ton of base language crap
>>
>>61452855
Are you saying >>61452844 is a she?
That basically invalidates everything she was saying, then.
>>
>>61452806
>I'm not a Rust user.
>I'm just saying that C is trash
-- Every rustfag in /dpt/
>>
>>61452844
>Pointers make everything complex.
Pointers are simple. Pointer arithmetic makes things fucked.
>>
>>61452848
Quite a few of them are pointers to VLAs or buffers the user passes in, as well as state that may or may not increment and I may need to backtrack to.
It doesn't "naturally" fit into a struct.
>>
>>61452867
Make sense since people who shill for rust are just telling others to rewrite their shit in rust.
Nobody actually uses rust.
>>
>>61452875
>functionXYZ takes 12 arguments
>make a functionXYZArgs struct
>>
>>61452852
>impossible
No, it's possible to make safe use of pointers once your security bug is discovered, companies lose millions of dollars for the 0-day and you fix it finally
>>
>>61452825
It is so fucking true.
But it is fun to see how people react to the name cunt.

It can sound angry while you are chill as fuck.

But cunt, don't you forget we are white and not fucking brown. Don't want the impurities in my country kk.
>>
>>61452867
>Hur dur you must be a Rust user to insult my shit language.
No, C is just simply shit. You don't have to be a Rust user to know that.
Although Rust users, who call C shit, are unaware that their own language is shit too.
>>
>>61452888
>A**tralians
>White
What does the orc mean by this?
>>
>>61452869
Pointer arithmetic is easy shit.
>>
>>61452888
Australians are not white
>>
>>61452886
It's quite possible to make pointers safe in a way that prevents any bugs in the first place.
Not in C though.
>>
>>61452888
Settle down wog
>>
File: you.gif (848KB, 500x281px) Image search: [Google]
you.gif
848KB, 500x281px
>>61452889
>>
>>61452888
not even aussies on /int/ say cunt that much, strewth m8
>>
>>61452852
>Makes c program that jumps into your little memory space.
>Do we have a measure to try some shit...

Sure you can secure use pointers, but that would imply you have created a perfect program. Always some dude who will fuck with "perfect programming".
>>
>>61452893
>>61452902
White (proper) Australians are white.
Petrol sniffers, gooks, rag heads, and other foreign shitheads are not Australians.
>>
>>61452916
Cunt like the R language retards are to cunty 4 me.

-
Maybe /int/ should fuck off and get dickheads who fucking know the local language.
>>
>>61452869
Pointer arithmetic is baby shit, mate. It would be shitload harder if it wasn't there.

>>61452844
>He doesn't understand pointers or any reference type
How long have you been programming? 3 days?
>>
>>61452914
>Aussie not wog
>>
>>61452935
Even if youre just RP'ing, /dpt/ with an obnoxious aussie sounds fun.

What language you use then?
>>
>>61452924
No, I don't mean "securely using raw pointers", I mean using actually safe pointers.
Like std::unique_ptr or std::shared_ptr.
Or Box/Rc/Arc if you're a Rust user.
>>
File: (you).jpg (42KB, 470x331px) Image search: [Google]
(you).jpg
42KB, 470x331px
>>61452930
>White (proper) Australians are white.
>Petrol sniffers, gooks, rag heads, and other foreign shitheads are not Australians.
>>
>>61452930
The term "proper Australians" is made up, Australians are savage niggers and they are called Maori. The so called "whites" are descendants of exiled degenerates
>>
>>61452902
Last time I checked my skin color would send the local tribes to their local petrol stations
>>
>>61452957
>Australians are savage niggers and they are called Maori
I'm pretty sure I've seen this pasta before.
>>
>>61452951
smart pointers aren't any safer by themselves, you can easily get dangling pointers still
>>
>>61452957
This
>>
File: 1476193622811.png (340KB, 696x696px) Image search: [Google]
1476193622811.png
340KB, 696x696px
>>61452962
>>
>>61452930
You forgot the Irish
>>
I live in Australia, and let me tell you that the whites are literally the worst. They run around the streets half naked in a drunk stupor while us civilised minorities can only watch in disappointment at Australia's fall into degeneracy.
>>
>>61452956
Your image doesn't make sense you stupid fucking cunt.
Why would a petrol sniffer go and say that petrol sniffers aren't Australians in defense of Australians?
>>
>>61452969
No you can't.
If you do, you spectacularly fucked up somewhere.
You should be getting any dangling pointers whatsoever with unique_ptr and shared_ptr
>>
>>61452981
Internalized racism, very sad
>>
>>61452980
Well, they are the descendants of criminals
>>
File: Shed.png (847KB, 640x480px) Image search: [Google]
Shed.png
847KB, 640x480px
>>61452976
When you live in a shed and not a house because you're a homeless programmer

>True aussies can't afford renting
>>
>>61452711
>>61452725
>>61452734
>this reddit-tier pun train that isn't funny, wasn't funny, and won't ever be funny

Reddit, fuck off right now.
>>
>>61452995
shouldn't*
>>
>>61453029
>reddit-tier
>waaah puns are bad
Someone needs to go back to redit
>>
>>61453028
With a net speed of 1 megabit and 0.13mbps up
>>
>>61452978
Irish classify as foreign shitheads, so I didn't forget them.
>>
File: 1453653416673.png (408KB, 680x560px) Image search: [Google]
1453653416673.png
408KB, 680x560px
>>61453037
>>61453029
(it's you)
>>
>>61453037
I love puns. However, reddit takes them too far. 1 and done. TWO at the absolute most.

Take the last one for example

>i can't believe sudid that

That's fucking awful, even for a pun.
>>
>>61452057

Would this be invalid?
T add(T)(T a, T b) pure
{
return a+b;
}
>>
>>61452950
>>61452950
English Australian.

What sort of crowed do we have here.
I mean I lerk and jerk yet saying cunt sets you guys off to autism and racism
>>
>>61453059
Shut up faggot, all puns are good
The "bad pun" meme is just as bad as the "ugh, "arrow to the knee" meme" meme
>>
import importlib
import sys
import time

modules = [importlib.import_module(arg) for arg in sys.argv[1:]]

wealth_sources = [
{
'info': module.info(),
'tick': module.tick(),
} for module in modules[1:]
]

print(modules[0].get_string_representation(wealth_sources))


its an abstract kind of feel

>>61452754
>iq of 70
>
    System.out.println("For multiplication questions please enter" + "the number 1");


I can believe that (´・ω・`)
>>
post more Rust
>>
>>61453069
lul I missed that when looking it over. That's a mistake a lot of learners would make though.
>>
File: RAGE.jpg (33KB, 291x300px) Image search: [Google]
RAGE.jpg
33KB, 291x300px
I acutally hate austarlians so fucking mauch. they are literally the worst human scum i think that they should just fucking die we should just nuike them and turn that shuit hole island into a waste land, which woul dbe an improve to the alreadu yshitstain waste land that fucking country is in
>>
>>61453059
I cannot believe that the letter Autism said that

Are you an ALPHAbet
>>
File: 1475425904101.jpg (239KB, 860x460px) Image search: [Google]
1475425904101.jpg
239KB, 860x460px
>>61453083
>>
>>61453083
RUST IS SHIT

Stop using some a helping language. Only reason Rust is used today is because able shilled it
>>
File: puns.png (24KB, 479x235px) Image search: [Google]
puns.png
24KB, 479x235px
>>61453093
>>61453068
Look, I even edited some reddit posts to show you how annoying it looks. It looks perfectly at home
>>
>>61453146
Is that what reddit looks like?
>>
>>61453091
Strewth mate, We're just taking the piss.
>>
>>61453061
Nope.

If you really want to get /proper/, youd do:

T add(T)(inout T a, inout T b) pure nothrow @nogc
{
return a+b;
}
>>
>>61453152
that's pretty much every reddit post, just stacked puns. There's disgusting racism/classcuckery here and annoying dumb reddit garbage there. Internet culture is officially normie.
>>
>>61453178
>assuming + is pure nothrow nogc for all inputs
>>
>>61453178
>inout
please explain this
>>
>>61453185
Racism and classism is healthy and normal.
Having special terms for them is abnormal.
>>
>>61453146
Wouldn't it leaf me with a pipeline man who ask who am I even when we are at home.

I am going to need info on the reason you hate those punns
>>
File: god.jpg (19KB, 480x360px) Image search: [Google]
god.jpg
19KB, 480x360px
>mfw + operator in sepples could be mallocing shit with out freeing
>>
>>61453207
>Racism and classism is healthy and normal.
yeah if you're spooked out of your fucking mind
>>
>>61453215
>functions may leak memory
who'd have thought?
>>
>>61453221
Anti-racism is a white social construct
>>
>>61453188
>
>>61453189
its to ensure transitive types when dealing with const/immutable/mutable stuff.
>>
File: aadsffdsfd.jpg (36KB, 640x960px) Image search: [Google]
aadsffdsfd.jpg
36KB, 640x960px
>>61453221
heh.. try not spook urself kid
>>
>>61453209
% make fire
Make: Don't know how to make fire. Stop.

% why not?
No match.

% gotta light?
No match.

% !1984
1984: Event not found. # (on some systems)

% How's my lovemaking?
Unmatched '.

% "How would you rate Bush's incompetence?
Unmatched ".

% [Where is Jimmy Hoffa?
Missing ].

% [Where is my brain?
Missing ].

% ^How did the sex change^ operation go?
Modifier failed.

% If I had a ( for every $ Congress spent, what would I have?
Too many ('s.

% man: why did you get a divorce?
man:: Too many arguments.
>>
>>61452844
>Pointers make everything complex
>complex
Quit programming.
>>
>>61453090
Yeah I'm just messing with you, I made the same exact mistake countless times when I was starting out with VB6 ages ago
>>
>>61453224
operators in C cannot do that. Holy shit sepples is bad.
>>
>>61453252
Operators in C may cause demons to fly out your nose and preprocessor directives in C may cause Emacs to start and play a tower of Hanoii simulation.
>>
>>61453250
Complexity on develops when programmers do not break down large tasks correctly.

Agile idiots call it complex
>Quit programmer
Some idiot on 4chan believes I was serious
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>
>>61453252
anything user-definable can leak memory if it's sloppily written. I don't see your point.
>>
>>61453239
% ar m God
ar: God does not exist

% make love
Make: Don't know how to make love. Stop.

Supposedly on older Sun's make will also tell you

Make: Don't know how to make love. How about war instead?

% sleep with me
bad character

% ^What is saccharine?
Bad substitute.

% drink yellow_pages
yellow_pages: Is a directory

%touch me
%chmod 000 me
%touch me
touch: cannot touch me: permission denied

% ar x "my love life"
ar: my love life does not exist

% ar x "matey, the treasure"
ar: matey, the treasure does not exist

% talk Gorvachev@Kremlin
talk: Kremlin: Can't figure out network address.

% talk Comrade Khruchev
[Your party is not logged on]
>>
>>61453251
I was just looking it over, I didn't write that.

>>61453228
race is also a social construct
>>
>>61452754
well, your goal to make a multiplication questioning machine turned out fine, nothing else really to say that isn't nitpicking (like use String[] args, erase the "\n", etc)

you may want to next consider tuning your code in situations where it handles stupid human scenarios
>what if the user provided an answer != 1
>what if the user provided a String instead of an int
>if i==numberQuestions, its still going to say "You're correct, next question" despite the program ending. How do you change that?
>>
>>61453306
>race is also a social construct
In that case, other people are different subspecies.
>>
>>61453306
What's your evidence for that?
>>
this sure is some quality programming discussion.
>>
>>61453380
>majority C fags and a couple of Rust shillers
what did you expect?
>>
>>61453272
>none of the newfags in this thread will get the joke(s)
>>
>>61453405
Didn't really expect them too either, but cheers to you at least.
>>
>>61453275
> I don't see
>sepples shitter cannot cee
Well no shit
>>
how easy is it to sort a vector in Rust without including anything

fn main() {

let mut v = vec![5, 4, 3, 2, 1];

v.sort();

print!("{:?}" , v);
}
>>
>be hasklet
>hello world doesn't even work
module Main where

main = putStrLn "Hello, World!"

Linking Main ...
/usr/bin/ld: cannot find -lHSbase-4.9.1.0
/usr/bin/ld: cannot find -lHSinteger-gmp-1.0.0.1
/usr/bin/ld: cannot find -lHSghc-prim-0.5.0.0
/usr/bin/ld: cannot find -lHSrts
collect2: error: ld returned 1 exit status
`gcc' failed in phase `Linker'. (Exit code: 1)
>>
>>61453037
pun chains are the definition of reddit, awkward white kid tier "humor"
>>
>>61453470
It's not awkward at all.
The only one standing out is you
>>
>>61453454
Can you not do
 print!("{:?}" , v.sort);

?
>>
>>61453456
>needing to link four dynamic libraries in order to print a string

No wonder why Haskell fags consider IO to be impure and avoid it at all costs.
>>
>>61453456
>be too stupid to hello world
>blame language
is this the new thing
>>
>>61453454
>rust
>safe
fn main() {

let mut v = vec![5, 4, 3, 2, 1];

v[10]
}
>>
>>61453487
why? it's comfy
>>
>>61453479
upvoted
>>
>>61453502
You have a problem
>>
>>61453509
downvoted
>>
>>61453497
>error: index out of bounds
>>
>>61453500
>doing
print!("{:?}" , v.sort());


Just returns empty ()s, man rust sure is weird.
>>
>>61453527
See? Rust is as unsafe as C. If it was a proper language it would throw a compile error instead.
>>
>>61453537
uwotm8, it does throw a compile error like any lang should
>>
>>61453533
weird to me too bro, idk

I'm shilling while learning myself
>>
>>61453553
Try
fn f(n: usize) {
let mut v = vec![5, 4, 3, 2, 1];
v[n]
}

fn main() {
f(10)
}
>>
>>61453553
>like any lang should
that's debatable

bounds checking is expensive, slows down your algorithms
>>
>>61453572
Compiling playground v0.0.1 (file:///playground)
error[E0308]: mismatched types
--> src/main.rs:3:3
|
3 | v[n]
| ^^^^ expected (), found integral variable
|
= note: expected type `()`
found type `{integer}`

error: aborting due to previous error

error: Could not compile `playground`.
>>61453573
thats what asserts are for
>>
>>61453592
>thats what asserts are for
yes

but who knows how they turn it off in Rust?
>>
>>61453592
>error[E0308]: mismatched types
ofc, the rust gayness
add a u or whatever after the 10, don't remember what they add.
>>
>>61453609
I would hope asserts are auto-turned off on --release.
>>61453610
f(10u) yields
 Compiling playground v0.0.1 (file:///playground)
error: invalid suffix `u` for numeric literal
--> src/main.rs:7:5
|
7 | f(10u)
| ^^^
|
= help: the suffix must be one of the integral types (`u32`, `isize`, etc)

error[E0308]: mismatched types
--> src/main.rs:3:3
|
3 | v[n]
| ^^^^ expected (), found integral variable
|
= note: expected type `()`
found type `{integer}`

error: aborting due to previous error

error: Could not compile `playground`.
>>
>>61453496
I simply followed the wiki faggot.
https://en.wikibooks.org/wiki/Haskell/Standalone_programs
>>
>>61453632
Did you use cabal?
>>
>>61453632
>needing to follow a wiki to do hello world

anyway it's pretty clear you've got a linking error
how did you install & what os?
>>
>>61453625
fn f(n: usize) -> usize {
let v = vec![5, 4, 3, 2, 1];
v[n]
}

fn main() {
f(10);
}


   Compiling playground v0.0.1 (file:///playground)
Finished dev [unoptimized + debuginfo] target(s) in 0.55 secs
Running `target/debug/playground`
thread 'main' panicked at 'index out of bounds: the len is 5 but the index is 10', /checkout/src/libcollections/vec.rs:1488
note: Run with `RUST_BACKTRACE=1` for a backtrace.
>>
>>61453646
>>61453648
I fixed it. Apparently the ghc package provided by Arch Linux doesn't allow static linking.
https://wiki.archlinux.org/index.php/Haskell#Problems_with_linking
>>
>>61453665
For those interested in the size of a hello world in Haskell:
Dyanmic linked: 18K
Static linked: 1.2M
>>
>>61453682
still it generates garbarge with 1GB/s rate
>>
>>61453661
wait, >>61453553 lied
fn main() {
let v = vec![5, 4, 3, 2, 1];
v[10];
}


   Compiling playground v0.0.1 (file:///playground)
Finished dev [unoptimized + debuginfo] target(s) in 0.57 secs
Running `target/debug/playground`
thread 'main' panicked at 'index out of bounds: the len is 5 but the index is 10', /checkout/src/libcollections/vec.rs:1488
note: Run with `RUST_BACKTRACE=1` for a backtrace.
>>
>>61453696
[citation needed]
>>
>>61453682
the haskell standard library is pretty monolithic
>>
>>61453702
Literally dont care enough to try to stage an elaborate error of a language i dont know.
I like discussing rust m8s, just not use it.
>>
>>61453713
>so it's not uncommon to produce 1gb of data per second
https://wiki.haskell.org/GHC/Memory_Management
dumb haskell poster.
>>
>>61453702
>>61453717
also it was because v was mut apparently.
>>61453572
>>
File: haskell.png (237KB, 1328x1768px) Image search: [Google]
haskell.png
237KB, 1328x1768px
>>61453713
>Haskell computations produce a lot of memory garbage - much more than conventional imperative languages. It's because data are immutable so the only way to store every next operation's result is to create new values. In particular, every iteration of a recursive computation creates a new value. But GHC is able to efficiently manage garbage collection, so it's not uncommon to produce 1gb of data per second

https://wiki.haskell.org/GHC/Memory_Management
>>
>>61453731
no, mut makes no difference
>>
>>61453746
then it was passing n instead of 10
>>
>>61453725
Read the whole paragraph.
>>
>>61452781
That image is stupid.

Why in the world would you be able to slap a "+" operator on two arbitrary types without knowing anything else about them?
>>
File: 1495716144204.jpg (3MB, 3872x2592px) Image search: [Google]
1495716144204.jpg
3MB, 3872x2592px
>>61453732
>tfw someone uses your OC
>>
>>61453732
Is this fucking real?
Who the fuck would want a language like that?
>>
>>61453732
Haskell is an interesting language, but I wouldn't use it in production.
>>
>>61453757
>im just gonna pass two bitmask function pointers to my add_sum function
>>
>>61453755
no, still compiles
>>
>>61453756
>But it's garbage collected so it's okay bro!!! Trust me bro!! It's okay bro!!

You're literally wasting CPU cycles and memory, potentially even swapping out memory that is critical, all completely unnecessary because it's "pure".

This is a friendly reminder that functional programming is absolutely godawful on von Neumann architectures and should really just remain a pen and paper languages, as they were originally intended.
>>
>>61453781
well i dont know, i keep rust in the playground for a reason, i probably just copied the block wrong
>>
>>61453732
The hello world part is a lie. It's 18K on my machine. I don't know about the memory footprint. I guess it's true.
>>
>>61453775
>allowing runtime errors due to type incompatibility
It's 2017.
>>
>>61453785
> i dont know what pure means
Immutability has nothing to do with purity.
>>
>>61453767
It was a good image, the only thing I want to complain about is that you didn't cite the entire paragraph for the 1 gb per second quote.

>>61453768
It's intended as learning tool for writing beatiful functional programming.

>>61453774
Indeed.
>>
most popular buzzwords in programming in 2k17
>opinionated
>reason about
>safety
>>
>>61453795
>runtime
That wouldnt even get past my static if
>>
>>61453807
code of conduct
>>
>>61453807
the year of Rust programming
>>
>>61453801
Pure means side-effect free.
Immutability is a one of the methods Haskell employs make a "no side-effects" guarantee for a function.
>>
>automatic garbage collection will become part of C++
>Bjarne Stroustrup

C++ brainlets will defend this
>>
>>61453802
>It was a good image, the only thing I want to complain about is that you didn't cite the entire paragraph for the 1 gb per second quote.
1) it's a collage
2) it's bullshit
>>
>>61453792
18K but includes dynamic libraries. If you static link those, it's bigger.
>>
>>61453835
>C++ will get a GC when D finally gets rid of its
What a time to be alive
>>
>>61453807
>most popular programming buzzwords in 2017
>safety
absolutely, and I use Haskell
>>
>>61453838
3) it triggers Haskell fags, which is why I posted it
>>
>>61453835
java is fast as fuck with its garbage collector
>>
File: haskell ffi.png (5KB, 442x55px) Image search: [Google]
haskell ffi.png
5KB, 442x55px
>>61453862
>triggers haskellfags
>made by a haskellfag
thinking so really makes me right now
>>
>>61453785
I agree that functional programming is highly inefficient. It's only efficient in lines of code.
The thing is: it's comfy to write. I don't like Java style OOP and exceptions. If you have any suggestions for a 'proper' language, tell me.
>>
>>61453872
Highly controlled pure mutability in an otherwise immutable language is the future.
One of you fags better get on it before i do
>>
>>61453870
>>declaring foreing function requires you to type more than the original c declaration
Haskell has shitty ffi
>>
>>61453895
Probably because it isn't C
>>
>>61453866
You don't fully understand the issue with using a BFS garbage collector if you think how fast or not is relevant. The problem with garbage collectors is that they are indeterministic. Execution in your program must be halted at some execution point in order for the garbage collector to run. If you make real-time applications or other latency sensitive applications, this behaviour is unacceptable.

Imagine an online FPS where the game position is sent out to all the clients at once. Now imagine if 90% of the clients get the position update, but the remaining 10% get it some few milliseconds later because the GC was scheduled right before the position update was sent out on the remaining connections.
>>
>>61453862
You do realize haskell programmers are high IQ human beings with a top notch sense of humor and self-awareness, right?
>>
>>61453239
>>61453290

I like these though, anon.
>>
>>61453892
Do you mean like Rust? It takes a while to get used to, but I like it. C++ on the other hand is a nightmare, unless you only use a subset of it. I also tried Clojure, but I never tested its performance.
>>
>>61453872
>The thing is: it's comfy to write.
I agree, I like the functional way of thinking. I also like to mix paradigms, use functional where it makes sense.

> I don't like Java style OOP and exceptions. If you have any suggestions for a 'proper' language, tell me.
Well, I like multiparadigm languages. I don't personally care for Java, but I like for example C++. You can implement maybes in C++ (using std::optional) for example. But I happen to like exceptions, from an imperative point of view it allows you to write code that assumes a successful execution path (and this allows the compiler to optimize for the successful path), and rather treat errors as, well, exceptions.

I guess Rust or something is probably better in your case. Or maybe something completely different, I don't know.

>>61453870
I know you are an Haskell fag, I wasn't referring to you (the guy that made it), I was referring to the people who get upset about it.
>>
>>61453933
No, deterministic memory more on the style of a haskell or idris.
>>
File: 1489268801010.jpg (38KB, 250x250px) Image search: [Google]
1489268801010.jpg
38KB, 250x250px
I'm >>61450580 from the last thread.
I managed to modify my function so it matches closer to what I want:
https://pastebin.com/nEC1MtLr

Please rate.
>>
>>61453911
I don't think anyone that lurks 4chan have exceptionally high intelligence or even possess the ability for reflected and self-critical humour.
>>
>>61453907
you're supposed to fine tune your gc in java for your needs
>>
File: 346.jpg (62KB, 410x412px) Image search: [Google]
346.jpg
62KB, 410x412px
Hi guys I'm a genius at building computers, do you think I would do good at programming? Thanks in advanced for any answers
>>
>>61453969
I am personally very smart
>>
>>61453933
>It takes a while to get used to,
no shit >>61452354
>>
>>61453976
They literally have nothing to do with each other.
That's like saying someone would be good at fixing microscopes because they are a biologist.
>>
PE > ELF
>>
>>61453973
Java works fine for workloads that aren't latency sensitive, but for workloads that are, you're better off with a programming language that doesn't suspend execution aside from where it is explicitly stated by the programmer.
>>
>>61453949
>I know you are an Haskell fag, I wasn't referring to you (the guy that made it), I was referring to the people who get upset about it.
but people mostly just get upset about people constantly replying >1gb/s
>>
>>61453993
>They literally have nothing to do with each other.
autism is autism, imho

if has patience to build hardware, probably can learn programming too >>61453976
>>
>>61453999
agreed
>>
>>61453999
PE has too much legacy shit.

Mach-O > both
>>
>>61454010
I personally just post that that IO monad is a stateful container and that the only way to write real pure code is to avoid IO all together, and then usually all hell breaks loose.
>>
>>61454081
But IO can be pure
>>
>>61453949
I did use C++ for my pet projects for a year or so until I got tired of it. It's not a bad language, but it has some cringy shit like CMake and streams. That was pre C++11, so I may like it more now. I feel like Rust is the middle ground between Haskell and C++. It has functional constructs and the speed of C++.
I'm still looking for a good language to hobby in. That's why I ventured into functional langauges like Racket, Clojure and Haskell. They're interesting, but impractical. What language would you recommend? Maybe pick up C++ again, or continue with Rust?
>>
>>61453835
In 2038, right after modules
>>
>>61454093
Yeah, because of the "only the runtime is tainted, not the code" mental gymnastics argument.

It's meant as a troll anyway.
>>
File: consider.jpg (29KB, 600x600px) Image search: [Google]
consider.jpg
29KB, 600x600px
new thread
>>61454112
>>
>>61454104
>but it has some cringy shit like CMake and streams
CMake is not part of the language

And I usually avoid IO streams.

>That was pre C++11, so I may like it more now.
Pre C++11 was pretty awful actually. I mean, it's still preferable to C in some ways, but functors was really a poor man's first class function.
>>
File: ss-2017-07-19-14-34-06.png (186KB, 957x719px) Image search: [Google]
ss-2017-07-19-14-34-06.png
186KB, 957x719px
>>61453907
>You don't fully understand the issue with using a BFS garbage collector if you think how fast or not is relevant. The problem with garbage collectors is that they are indeterministic. Execution in your program must be halted at some execution point in order for the garbage collector to run. If you make real-time applications or other latency sensitive applications, this behaviour is unacceptable.
you can manage it just fine. java is successfully used for anti-missile defense systems http://www.artist-embedded.org/docs/Events/2011/JTRES/Slides/JTRES-Winkler.pdf
>>
>>61454104
I think Rust is comfy as fuck. If you know it, good for you.
>>
>>61454104
C++11 was a breath of fresh air for the language, but it's still not great for functional programming. At least you finally have lambdas.
>>
>>61454104
To further elaborate, I'm looking for a language with the following characteristics:
- Compiles to native code
- No Java style OOP
- Library support (ideally using a package manager)
- Functional constructs
- Static type system
Some languages I considered: C++, Rust and Scala (even though it's a hosted language)
>>
>>61454104
>[C++ is] not a bad language, but it has some cringy shit like CMake
What the fuck? CMake is a build tool, it has nothing to do with C++
>>
>>61454151
but every seppleshitter uses cmake so they might as well be the same thing.
>>
>>61454138
>http://www.artist-embedded.org/docs/Events/2011/JTRES/Slides/JTRES-Winkler.pdf
It's clearly written in multiple languages. Ada and C and C++ for performance critical and low-level stuff, Java for convenience stuff.
>>
>>61454104
rust is pretty fun to figure out. I much prefer the descriptive compiler errors to C++'s segfaults

>>61454151
languages don't exist in a vacuum
>>
>>61454151
>industry standard build tool
>has nothing to do with C++

set(OP_IS retarded)
>>
>>61454151
I meant build tools, or the lack of, in general for C++. They're shit. Rust does a much better job with Cargo.
>>
>>61454176
>but every seppleshitter uses cmake
No, they don't. We use Visual Studio projects and in my last job they used autoconf.
>>
>>61454207
>microcuck thinks he is relevant
>>
>>61454212
C++ is a Microsoft language.
>>
>>61454195
>>61454176
>>61454192
>C++ is shit because Makefiles are shit
Nice logic you guys have.

I'm going to say that Clojure is shit because Ant is crap.
>>
>>61454200
I tried autotools, cmake, qmake and regular makefiles. They're all a pain to work with.
>>
>>61454212
Microsoft is on the C++ committee board.
>>
>>61453537
>Rust is as unsafe as C
No, you have no idea what you're talking about.
In C, it will access invalid memory and invoke undefined behavior. It might segfault, it might corrupt memory, it might send dragons flying out of your USB ports, it might do nothing at all.
In Rust, it will always just panic.
>>
>>61454222
>Makefiles
not make, CMake https://www.youtube.com/watch?v=bsXLMQ6WgIk
>>
>>61454234
they let a microcuck into the gcc meeting?
>>
>>61454222
He's partially right though. I am a fan of C++ but I wish there was a standarized build system for it maintained by the folk behind C++. Something akin to Cargo (of Rust) or npm (of NodeJS).
>>
>>61454243
It is about as relevant argument, your logic is still retarded. On Linux every build system synthesizes ultimately to Makefiles. CMake does it, autotools does it, autoconf does it. I wouldn't be surprised if even scons does it too.
>>
>>61454275
that's not the point of cmake, it's the universal cross-platform shit (or trying to be)
>>
>>61454269
>he wants npm for C++
Oh god kill it with fire.

>>61454264
>gcc
GCC is a compiler, they have little influence over the committee. Also a friendly reminder that the entire reason widechars exist in the C and C++ standards, are solely because Microsoft sat on both committees at the time and crowbarred their broken character set encoding into the language standards.

C and C++ are forever tainted and cucked by Microsoft.
>>
>>61454297
You're trying to weasel your way out, but it's not going to work you retard.

CMake being shit (or not shit) has nothing to do with the C++ language. Now kill yourself for being so obvious.
>>
>>61454241
>In C, it will access invalid memory and invoke undefined behavior. It might segfault, it might corrupt memory, it might send dragons flying out of your USB ports, it might do nothing at all.
Use an implementation that throws an error

>In Rust, it will always just panic.
Because you use an implementation that throws an error.
>>
>>61454321
>Use an implementation that throws an error
See? UB.
It's not even standard.
>>
>>61454338
And? Nothing wrong with that.
>>
>>61454321
>Because you use an implementation that throws an error.
No, it's guaranteed across all Rust implementations.
>>
>>61454319
>You're trying to weasel your way out, but it's not going to work you retard.

lol

cmake still has nothing to do with make and cmake is industry standard
>>
>>61454352
No, rust does not even have a standard.
>>
>>61454346
Let me add it to the list then,
In C, it will access invalid memory and invoke undefined behavior. It might segfault, it might corrupt memory, it might send dragons flying out of your USB ports, it might throw an error, or it might do nothing at all.

>2017
>Using C
>>
>>61454357
thank G-d for that
>>
>>61454321
>Use an implementation that throws an error
You shouldn't rely on implementation specific behaviour. That's first of all horrible practice, and secondly it's near impossible because non of the popular implementations do this; they rely on the OS' page handler.

You clearly know nothing about C or C implementations.

>Because you use an implementation that throws an error.
That's because the Rust standard specifies what's supposed to happen. The C standard doesn't.
>>
>>61454354
>and cmake is industry standard
No
Also nothing with cmake will compile.
>>
>>61454354
>cmake still has nothing to do with make
CMake generates (among other things) Makefiles. They have very much to do with each other.

>cmake is industry standard
So? It's still not C++
>>
>>61454357
>No, rust does not even have a standard.

Yet

>>61454368
>advocating non-standard language using non-standard practices
>>
>>61454369
>You shouldn't rely on implementation specific behaviour
Yeah, let's change languages instead!
This is retarded.

>because non of the popular implementations do this
Clang and GCC both have options for this.

>You clearly know nothing about C or C implementations.
Says the guy who is unaware that the two popular C implementations have that.

>That's because the Rust standard specifies what's supposed to happen
No such thing as the "Rust standard".
In any case, the only thing UB does is to give you freedom, why do you hate freedom anon?
>>
>>61454389
>CMake generates (among other things) Makefiles. They have very much to do with each other.
you're not supposed to edit those files so it's irrelevant what it generates on a particular OS
>>
>>61454410
>>advocating non-standard language using non-standard practices

there should be a slow moving committee of oldfags from academia and industry shills to fuck everything up and not include useful stl features even after 30 years
>>
>>61454416
>Yeah, let's change languages instead!
That's the Rust approach. It's still in development.

>Clang and GCC both have options for this.
No, they don't. They rely on the OS page handler to raise a general protection fault when the runtime accesses an invalid memory address. For addresses that happens to be mapped, it is undefined what happens. So in other words, you can for example write to the VGA buffer unintentionally if you don't check your pointers.

>Says the guy who is unaware that the two popular C implementations have that.
See above.

>In any case, the only thing UB does is to give you freedom, why do you hate freedom anon?
UB causes demons to fly out your nose and Emacs to open up and play a tower of hanoii simulation.
>>
>>61454439
Exactly.

>>61454419
And CMake is irrelevant to C++. Check and mate.
>>
>>61454459
>And CMake is irrelevant to C++.
then what is relevant?

like the other anon said, cmake is most popular and everything is cringy shit
>>
>>61454481
>cmake is most popular
[citation needed]

Autotools are by far the most popular build system. Even raw Makefiles are used more than CMake.
>>
>>61454449
Check https://en.wikipedia.org/wiki/AddressSanitizer as well as https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler

>UB causes demons to fly out your nose and Emacs to open up and play a tower of hanoii simulation.
Which is why you would not use #pragma on gcc 2 or on any compiler that you do not target.

Instead, this is not a behaviour that a program would depend on, this is simply the compiler behaviour on UB.
>>
>>61454497
This
>>
>>61454512
>https://en.wikipedia.org/wiki/AddressSanitizer
That's a memory debug utility, similar to valgrind.

>https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler

This clearly states that it relies on hardware to do some memory initialisation and bounds checking. I don't understand how this is in anyway helping your point? If anything, it's strengthening my point, that the compiler doesn't do any extra handling and leaves it to the OS and hardware to enforce memory protection.

>Instead, this is not a behaviour that a program would depend on, this is simply the compiler behaviour on UB.
You're missing the point completely. The point is that you should NEVER EVER rely on undefined behaviour what so ever, because it is undefined.
>>
>>61454552
>That's a memory debug utility, similar to valgrind.
Not only, it can detect all kinds of UB and crash the program along with an error when they happen.

>This clearly states that it relies on hardware to do some memory initialisation and bounds checking
Yes, it is another solution if you use modern hardware.

>If anything, it's strengthening my point
Your point was proven wrong when I posted about the sanitiser.

>that the compiler doesn't do any extra handling
It adds the instructions that do the bounds checking in that case.

>The point is that you should NEVER EVER rely on undefined behaviour what so ever
Heh

>because it is undefined
Except when an implementation defines it. (such as in this case)
>>
>>61454602
>Not only, it can detect all kinds of UB and crash the program along with an error when they happen.
It's still intended as a debug utility, and not a "catch all UB" safeguard. It only checks memory accesses, it doesn't handle uninitialised variables for example.

>Yes, it is another solution if you use modern hardware.
It's hardware and a compiler extension, it has little to do with C.

>Your point was proven wrong when I posted about the sanitiser.
Uh, no. It relies on using shadow memory, which means that you don't use it in production.

>Except when an implementation defines it. (such as in this case)
No, it doesn't define it. You're confusing implementation defined behaviour (unspecified behaviour) and undefined behaviour. I suggest reading the standard, those things are very different.
>>
>>61454602
>>61454512
>On average, the instrumentation increases processing time by about 73% and memory usage by 340%
>>
>>61454649
>It only checks memory accesses
Well you clearly haven't used it then. It detects tons of UBs, even integer overflows.

>it doesn't handle uninitialised variables for example
It does not do that indeed, but gcc is good to detect that by itself and issue a warning for it.

>It's hardware and a compiler extension, it has little to do with C.
It allows an implementation to have defined behaviour on many cases of undefined behaviour.

>No, it doesn't define it. You're confusing implementation defined behaviour (unspecified behaviour) and undefined behaviour
Yes it does.

>I suggest reading the standard, those things are very different.
I am aware of the difference.

>>61454660
This is why you might prefer to use the skylake instructions.
>>
>>61454698
>It allows an implementation to have defined behaviour on many cases of undefined behaviour.

You're so fucking retarded it hurts. Undefined behaviour is undefined. You can't "define it", what a stupid fucking thing to even type out.

I'm done, you're either trolling or you're legit retarded. Either way, this is pointless.

>This is why you might prefer to use the skylake instructions.
Talking out of your ass too, the number referred to AddressSanitizer.
>>
>>61454740
>You can't "define it"
Undefined in the standard, defined on the implementation. What is so difficult to understand?

>the number
What?

>referred to AddressSanitizer
I referred to both, see >>61454512
>>
>>61454698
>even integer overflows
Except it fucking doesn't

>It is also not capable of preventing all arbitrary memory corruption bugs. Arbitrary write bugs due to integer underflow/overflows (when the integer with undefined behavior is used to calculate memory address offsets)
https://en.wikipedia.org/wiki/AddressSanitizer#Limitations
>>
>>61454756
>Undefined in the standard, defined on the implementation.
That's referred to as unspecified behaviour in the standard, you mongoloid.

>I referred to both
I referred to AddressSanitizer, which works by creating a fake address space for the process (which is why performance sucks balls, akin to why valgrind sucks balls because it wraps all memory functions). There's no "skylake instructions" for this.
>>
>>61454756
>>the number
>What?
>
>>referred to AddressSanitizer
>I referred to both, see >>61454512(You)
Nevermind, just understood what he said.

>the number referred to AddressSanitizer.
Yes, and since the address sanitiser is slow, you might prefer to use the skylake instructions. How dumb can you be?

>>61454765
>Except it fucking doesn't
-fsanitize=signed-integer-overflow
>>
>>61454788
>That's referred to as unspecified behaviour in the standard, you mongoloid.
Did I claim otherwise anywhere?

>There's no "skylake instructions" for this.
I never claimed that there were "skylake instructions" for the AS.
>>
>>61454512
>on any compiler that you do not target.
You should not have to "target" a specific range of compilers
It should just simply have the same behavior on all conforming implementations.
>>
>>61454835
>You should not have to "target" a specific range of compilers
You don't need to have a target for this specific case as you do not need to make any change in the code in order to support it.

>It should just simply have the same behavior on all conforming implementations.
While I agree, I would say that having different behaviour on different implementations is not necessarily worse than changing language.
>>
>>61454803
>Did I claim otherwise anywhere?
Yes, you claim to understand the difference between undefined behaviour and unspecified behaviour.

Unspecified behaviour means that the compiler chooses what to implement, so the programmer needs to be aware of this. In other words, it's valid C but you need to refer to the compiler.

Undefined behaviour means that the programmer should avoid relying on it all together. In other words, not valid C.

Accessing a random address is undefined behaviour, not unspecified. Signed integer overflow is UB.

char being unsigned or signed by default is implementation specific.

>I never claimed that there were "skylake instructions" for the AS.
MPX only provides you with minimal bounds checking, it doesn't catch other forms of undefined behaviour at all, and in addiction, requires you to code with explicit compiler intrinsics.
>>
>>61454853
>as you do not need to make any change in the code in order to support it.
Did you even read your own link?

https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler

You need to explicitly use special compiler intrinsics to use it in your program.
>>
>>61454791
>since the address sanitiser is slow, you might prefer to use the skylake instructions.
You might prefer to use it, but you might also prefer to turn it off.

https://intel-mpx.github.io/performance/
>>
>>61454873
>Yes, you claim to understand the difference between undefined behaviour and unspecified behaviour.
Yes, and I do. I fail to see how this is relevant to what that you said before however.
>>That's referred to as unspecified behaviour in the standard, you mongoloid.
>Did I claim otherwise anywhere?
Your post just now did not prove that I claimed otherwise anywhere.

>In other words, not valid C.
No, UB does not imply invalid C, it does imply that you should probably avoid it in the general case.

>Accessing a random address is undefined behaviour, not unspecified. Signed integer overflow is UB.
Does not stop the implementations from defining their behaviour on these cases.

>>61454888
Did I claim otherwise? I don't remember doing so.

>MPX only provides you with minimal bounds checking, it doesn't catch other forms of undefined behaviour at all
Sure, I still never claimed that there were "skylake instructions" for the AS however.

>>61454923
Quite interesting article. I will definitely read it.
>>
The reason monads and ADTs are better than OO is because in practice you never need a nontrivial type that's not just a sum, product, and/or composition of other types and kinds, and it's much more shorthand and readable to define such a type in terms of such operations than to define it on its own terms as if it's a sort of thing all its own
If it would be preferable for users not to have to think about the implementation details you could always make it an opaque ADT but it should still be an ADT underneath that, classes on the other hand treat the issue as though opacity were all that matters and the ADT part didn't, they're dedicated to creating a tight caller interface at needless expense to maintainer sanity
>>
>>61454996
>type cirklejerking
just use untyped lambda calculus
>>
>>61454996
Care to elaborate through a practical example?
>>
>>61454944
>No, UB does not imply invalid C
A program relying on UB is either non-portable or an erroneous program. The result is totally unpredictable.

>Does not stop the implementations from defining their behaviour on these cases.
It means that you should not rely on these "definitions" because they are not part of C.

>Sure, I still never claimed that there were "skylake instructions" for the AS however.
I don't see how this misunderstanding is relevant, the point is that both ASan and MPX comes with additional performance costs, and not something you would use in production. MPX, at least in GCC and ICC, even requires you to use special intrinsics, and those intrinsics are different across compilers.

>Quite interesting article. I will definitely read it.
I suggest you do that right away, because it clearly shows that MPX has a performance penalty.
>>
>>61454996
>in practice you never need a nontrivial type that's not just a sum, product, and/or composition of other types and kinds
But those "other types and kinds" need to be defined somehow.
>>
>>61455022
>A program relying on UB is either non-portable or an erroneous program. The result is totally unpredictable.
Sure, still, does not imply invalid C.

>It means that you should not rely on these "definitions" because they are not part of C.
You are not relying on them in this specific case except if you are the user and use one of these implementations to compile your programs.
Also, should I consider that as an admission that you had no idea what you were talking before?

>the point is that both ASan and MPX comes with additional performance costs
Sure, just like most non-C languages. Never claimed otherwise here either.
In any case, I this discussion started because someone made the incorrect claim that this is not possible in C - performance is irrelevant to the topic.
>>
>>61455067
>Sure, still, does not imply invalid C.
It implies either non-portable or erroneous C. Both of these are invalid C so fuck off retard.

>Also, should I consider that as an admission that you had no idea what you were talking before?
No, fuck you cunt.

>someone made the incorrect claim that this is not possible in C
Nobody made this claim, you're lying.
>>
>>61455067
>In any case, I this discussion started because someone made the incorrect claim that this is not possible in C
It still isn't, you need to rely on external tools like ASan (aka not C) or special compiler intrinsics to do hardware magic (aka an extension to standard C). Neither of these are C.
>>
>>61455093
>Both of these are invalid C so fuck off retard.
No, not really.

>No, fuck you cunt.
Well, considering what you said just now, it shows that you had no idea what you were talking about a few posts above. Why are you refusing to admit it? Too prideful?

>>61455114
>like ASan (aka not C)
GCC is not C either, same for Clang. They are not C because they are not the C standard - they are implementations of it.

>or special compiler intrinsics to do hardware magic (aka an extension to standard C).
It seems that you do not need any change in the source code. (thus it is not an extension to standard C).
>>
>>61455141
>No, not really.
Yes really.

>Well, considering what you said just now, it shows that you had no idea what you were talking about a few posts above
Keep telling yourself that, you're still wrong.

>Why are you refusing to admit it?
Because I haven't changed position in anything I've said throughout this thread, I just tried to hammer it in using different words.


>GCC is not C either, same for Clang. They are not C because they are not the C
They are C implementations. ASan is not a C implementation, it is a utility program that wraps an executable (in this case a C runtime) in a fake address space.

This is not C.

>It seems that you do not need any change in the source code
You fucking do, moron. You need to program using explicit intrinsics. See Programming Model section.

Not only that, those intrinsics are different on Intel compilers.
>>
>>61455205
>Keep telling yourself that, you're still wrong.
Well, your posts prove me right.

>Because I haven't changed position in anything I've said throughout this thread
Sure thing man, the backpedalling in your posts is still there though.

>ASan is not a C implementation
It is part of C implementations.

>This is not C.
Sure it is. Just because an implementation defines a specific behaviour to be applied in some cases that the standard deems as undefined does not mean that the implementation is not a C one.

>See Programming Model section.
Done so
Still, I do not see any need for any change in the source code in order for the MPX extensions to be applied.
>>
>>61455262
>Well, your posts prove me right.
They don't, stay delusional.

>Sure thing man, the backpedalling in your posts is still there though.
Exactly where did I backpedal, you retard?

>It is part of C implementations.
No, it can be used with C implemtentations.

>Sure it is
It isn't, the standard fucking says that a program relying on undefined behaviour is either a non-portable program or an erroneous program.

>Just because an implementation defines a specific behaviour to be applied in some cases that the standard deems as undefined does not mean that the implementation is not a C one.
The implementation can be a valid C implementation, but the program relying on UB is invalid. Why is this so hard for you to accept?

>Still, I do not see any need for any change in the source code in order for the MPX extensions to be applied.
Are you completely retarded?

char q[10];
char* p = q;
p[11] = 'a'; // not catched by MPX


char q[10];
char* p = __bnd_set_ptr_bounds (q, 10); // equal to p = q if compiled without MPX compiler flags
p[11] = 'a'; // catched by MPX if enabled
>>
>>61455322
*caught, not catched
>>
>>61455322
>Exactly where did I backpedal
Here is an example >>61455022

>No, it can be used with C implemtentations.
Sure, and it's part of them.

>the standard fucking says that a program relying on undefined behaviour is either a non-portable program or an erroneous program.
Kek, no, not really.

>Why is this so hard for you to accept?
Because the standard does not say that a program that uses UB is invalid.

>Are you completely retarded?
Did you actually try it? __bnd_set_ptr_bounds is useful if you are making a malloc-like thing, accessing q[11] will throw an error anyway.
>>
>>61455401
>Here is an example
?

I don't see it.

>Sure, and it's part of them.
No, it's not. It's a standalone utility you have to install seperately.

>Kek, no, not really.
Kek yes really.


>Did you actually try it?
Yes

>__bnd_set_ptr_bounds is useful if you are making a malloc-like thing
No, it's required to set up MPX bounds.

>accessing q[11] will throw an error anyway.
It won't. In this trivial example it leads to a compiler warning (which is why I assigned q to p instead), but you need the intrinsic.
>>
>>61455466
>>61455401
Err, my mistake. For GCC prior to 4.8 you'd need to install it separately as a GCC extension. From 4.8 and newer it's integrated into GCC.
>>
>>61455466
>It's a standalone utility you have to install seperately.
Holy shit, how can this guy be THIS ignorant?
It is not a separate utility nor you have to install it separately. Was this a troll?
[edit: see the next reply]

>Kek yes really.
Okay then where does the standard exactly claim that?
Oh that's right, nowhere.

>Yes
Doubt.

>which is why I assigned q to p instead
Because __bnd_set_ptr_bounds returns a new address if I am not mistaken.

>>61455501
Still was not a separate utility, it was a library that you plugged into gcc.
>>
>>61455532
>Holy shit, how can this guy be THIS ignorant?
I corrected myself before you posted shithead, you're even responding to that post in your post.


>Still was not a separate utility,
You needed and still need to invoke your executable by setting environment variables to the correct path to that library. You're correct in that it's not a standalone utility, that was a misphrase from my part. But it works like valgrind by wrapping the address space.

>Because __bnd_set_ptr_bounds returns a new address if I am not mistaken.
It doesn't. See pic, more specifically the bnd* instructions.
>>
>>61455532
>>61455753
>>61455466
And either way, the program doesn't crash as you claimed. You need to set up proper target hooks, as explained in https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler#Links
>>
>>61451996
read "Clean Code by Robert Cecil Martin" when you got time
it helped me a lot making my code cleaner
>>
Rust will dominate the world
Thread posts: 399
Thread images: 34


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.